Expand Tree

Expands a TreeView control, according to the nodes entered. In computing, a TreeView is a graphic interface element that allows the user to display hierarchical data in the form of a tree, expand or collapse branches and nodes.

Syntax

expandTree --path(String) [--delay(TimeSpan)] [--forcerefresh(Boolean)] --selector(ControlSelectors) --id(String) --name(String) --innertext(String) --tagname(String) --xpath(String) --classname(String) --elementvalue(String) --controltype(Nullable<ControlTypes>) --index(Numeric) --control(Control) [--usetable(Boolean)] [--searchbycolumn(Boolean)] --searchcolumn(String) --searchvalue(String) --returncolumn(String) --row(Numeric) [--timeout(TimeSpan)]

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Path path Required Text Path in the TreeView to be expanded, separating each node with a line break.
Delay delay Optional Time Span, Number, Text Delay time between the expansion of each TreeView node.
Update Screen Cache forcerefresh Optional Boolean Enable to read the screen again before running the command. Use it to identify new elements and update the screen cache.

Note:This is needed if the screen changes frequently.
Selector selector Required ControlSelectors Type of selector used to identify user interface controls. See selector parameter options for more information.

Note:Use the IBM RPA Studio's recorder to map the controls and obtain the Selectors.
Id id Only when selector is Id, IdAndName Text Id of the TreeView control.
Name name Only when selector is Name, NameAndValue, IdAndName, TypeAndName Text Name of the TreeView control.
Text innertext Only when selector is InnerTextAndTag Text Inner text of the TreeView control.
Element Type tagname Only when selector is InnerTextAndTag Text Type of the element in which the TreeView is expanded.
XPath xpath Only when selector is XPATH Text XPath that leads to the TreeView control.
Class classname Only when selector is ClassAndValue, ClassName Text The class of the TreeView control.
Element Value elementvalue Only when selector is ClassAndValue, NameAndValue Text Current value of the element in which the TreeView is expanded.
Type controltype Only when selector is TypeAndIndex, TypeAndName ControlTypes Control type of the TreeView.
Index index Only when selector is TypeAndIndex Number Control index.
Control control Only when selector is Instance Control Control instance.

Note:Use the Search Control command to get the control.
Element in Table usetable Optional Boolean When enabled, makes it possible to find an element within a table by column or row.
Search by Column searchbycolumn Optional Boolean When enable, fetches the element through the column, not by row.
Column searchcolumn Only when element in table is True Text Name or number of the column from which to get the element.
Value searchvalue Only when search by column is True Text Value used to find the element in the table.
Return Column returncolumn Only when search by column is True Text Column that contains the control.
Row row Only when search by column is False Number Table row to find the element.
Timeout timeout Optional Time Span, Number, Text Command execution timeout.

Note:If no value is defined in the Timeout parameter, the execution uses the context time defined by the Set Timeout command. If the script does not use that command, the default time is 5 seconds.

selector parameter options

The following table displays the options available for the selector input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.

Designer mode label Script mode name Description
Class and value ClassAndValue Matches the element based on the class name and value attribute.
Class name ClassName Class name of the interface control in the browser.
Id Id Matches the element based on the ID attribute value.
Id and name IdAndName Matches the element based on the id and name attribute value.
Inner text and control type InnerTextAndTag Matches the element based on the element text content and the tag name attribute value.
Instance Instance Control instance
Link text LinkText Matches the element based on the link text attribute value.
Name Name Matches the element based on the Name attribute value.
Name and value NameAndValue Matches the element based on the name and the value attribute.
Type and index TypeAndIndex Type of control and index of the browser interface.
Type and name TypeAndName Type of control and name attributed to the browser.
XPath XPath Matches the element based on the XML path in the HTML root.

controltype parameter options

The following table displays the options available for the controltype input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.

Designer mode label Script mode name Description
Button Button It matches the Button control in the application.
Check box CheckBox It matches the Check box control in the application.
Child window ChildWindow It matches the Child window control in the application.
Combo box ComboBox It matches the Combo box control in the application.
Generic Generic It matches the Generic control in the application.
Image Image It matches the Image control in the application.
Label Label It matches the Label control in the application.
List box ListBox It matches the List box control in the application.
Menu bar MenuBar It matches the Menu bar control in the application.
Menu item MenuItem It matches the Menu item control in the application.
Progress bar ProgressBar It matches the Progress bar control in the application.
Radio button RadioButton It matches the Radio button control in the application.
Scroll bar ScrollBar It matches the Scroll bar control in the application.
Slider Slider It matches the Slider control in the application.
Spinner Spinner It matches the Spinner control in the application.
Status bar StatusBar It matches the Status bar control in the application.
Tab page TabPage It matches the Tab page control in the application.
Tab panel TabPanel It matches the Tab panel control in the application.
Table Table It matches the Table control in the application.
Text box TextBox It matches the Text box control in the application.
Tree view TreeView It matches the Tree view control in the application.
TreeTable TreeTable It matches the TreeTable control in the application.
Window Window It matches the Window control in the application.

Example

In the situation below, a TreeView control in a local application is expanded.

defVar --name applicationWindow --type Window
defVar --name executionSuccess --type Boolean
// Download the following file to execute the command.
launchOrAttach --executablepath "CSharpTestApp.exe" --title Users applicationWindow=value executionSuccess=success
assert --message "Did not find the demo application!" --left "${executionSuccess}" --operator "Is_True"
focusWindow --window ${applicationWindow}
expandTree --path "Tree\r\nColors\r\nBlue\r\n" --delay 00:00:01 --selector "Id" --id treeView1
// Wait 1 second between the expansion of each node to make visualization easier.