Wait Control
Verb: waitControl
Waits for a control specified by a user-defined selector to appear.
Controls are, in the context of Windows, elements that allow the user to interact with an application. Controls can be buttons, data entry fields, menus and various other elements.
Syntax
waitControl [--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)] (Boolean)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--forcerefresh | Update screen cache | Optional | Boolean | When enabled, performs a new reading of the screen before executing the command to identify new elements and update the screen cache.
This identification is necessary for the command to work, in case there are any changes on the screen. |
--selector | Selector | Required | ControlSelectors | Type of selector used to identify user interface controls. The following options are available:
It is possible to use the IBM RPA Studio's recorder to map the controls and obtain the necessary information for the “Selector” parameters, in addition to inserting commands in the script with automatic filling of these parameters. The recorder is available in the upper toolbar on the platform. |
--id | Id | Only whenSelector is Id, IdAndName | Text | Id of the Control that should be awaited. |
--name | Name | Only whenSelector is Name, NameAndValue, IdAndName, TypeAndName | Text | Name of the control that should be awaited. |
--innertext | Text | Only whenSelector is InnerTextAndTag | Text | Inner text of the control that should be awaited. |
--tagname | Element Type | Only whenSelector is InnerTextAndTag | Text | The type of the element that should be awaited. |
--xpath | XPath | Only whenSelector is XPath | Text | XPath that leads to the control that should be awaited. |
--classname | Class | Only whenSelector is ClassAndValue, ClassName | Text | Class of the control that should be awaited. |
--elementvalue | Element Value | Only whenSelector is ClassAndValue, NameAndValue | Text | Value of the element that should be awaited. |
--controltype | Type | Only whenSelector is TypeAndIndex, TypeAndName | ControlTypes | Type of control that should be awaited. |
--index | Index | Only whenSelector is TypeAndIndex | Number | Index of the control that should be awaited. |
--control | Control | Only whenSelector is Instance | Control | Control instance.
This variable is obtained using the command Search Control. |
--usetable | Element in Table | Optional | Boolean | When enabled, makes it possible to find an element within a table by column or row. |
--searchbycolumn | Search by Column | Optional | Boolean | When enabled, looks for the element in the table by column, instead of row. |
--searchcolumn | Column | Only whenElement in Table is True | Text | Column name or value |
--searchvalue | Value | Only whenSearch by Column is True | Text | Value used to find the element in the table. |
--returncolumn | Return Column | Only whenSearch by Column is True | Text | The column that contains the control. |
--row | Row | Only whenSearch by Column is False | Number | The table row for finding the element. |
--timeout | Timeout | Optional | Time Span, Number, Text | Command execution timeout.
If no value is defined in the timeout parameter, the execution uses the context time defined by the command Set Timeout. If the script does not use this command, the default time is 5 seconds. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Success | Boolean | Returns "True" if the command is successful, or "False" if otherwise. |
Example
The Launch and Attach Window command opens a Notepad window and the Wait Control command awaits for the application text box to appear, returning the success or failure in executing the command in the "success" variable. The value contained in "success" is demonstrated in the IBM RPA Studio console with Log Message.
defVar --name success --type Boolean
launchWindow --executablepath "notepad.exe"
waitControl --selector "XPath" --xpath "/root/document[1]" success=value
logMessage --message "Success: ${success}" --type "Info"
// Opens a Notepad window and waits for the text box.
Remarks
It is possible to use the IBM RPA Studio's recorder to obtain the following information:
The window containing the control that is awaited must be associated with the execution context.