Apply Object selectors
info
Object selectors are used for automating desktop applications only.
When automating desktop applications, you can provide a unique window or element locator using Object selectors, for example:
$("[CLASS: JToggleButton]").click()
If you set multiple attribute:value pairs separated by a semicolon in square brackets, the target element or window should meet all these descriptors and logic:
$("[CLASS: JToggleButton; TOOLTIP: JTable demo; TEXT: Start]").pressEnter()
If an attribute value contains a semicolon sign, escape it using another semicolon:
$([TEXT: Some text ;; with semicolons; CLASS: JTable]).click()
Attributes for desktop applications
| Criteria | Description | Example |
|---|---|---|
NAME | Element instance name. | [NAME: Toolbar] |
REGEXPNAME | Regular expression for element instance name. | [REGEXPNAME: \d{3}] |
TITLE | Element title. | [TITLE: Notepad] |
REGEXPTITLE | Regular expression for element title. | [REGEXPTITLE: /[a-zA-Z]+/g] |
CLASS | Element class. | [CLASS: JToggleButton] |
REGEXPCLASS | Regular expression for element class. | [REGEXPCLASS: J.] |
TEXT | Element text property. | [TEXT: Submit] |
REGEXPTEXT | Regular expression for element text property. | [TEXT: S[a-z]] |
INSTANCE | UI control instance number. | [INSTANCE: 42] |
CSS | jQuery-like CSS styles search in desktop UI tree controls. See more in Apply CSS selectors. | [CSS: .JPanel.JButton] |
XPATH | XPath search in desktop UI tree controls. See Effective XPath for more details. | [XPATH: //element[@class=Child3]/element[@class=JButton]] |
TOOLTIP | Element tooltip text for desktop applications. | [TOOLTIP: Open] |
Java-specific attributes
| Criteria | Description | Example |
|---|---|---|
PATH | Specify a path to a tree control element. Descendant texts are separated by a pipe. | |
LEVEL | Search in a specific tree level by its sequential number starting from 0 (JTree, DTree, and so on). | [LEVEL:3] |
TEXT_LEVEL | Search in a specific tree level by its text. | [LEVEL:Quartets] |
CELL | Search a Java table cell by its coordinates (row, column). | [CELL:2,1] |
CELLTEXT | Search a Java table cell by its text. | [CELLTEXT: Invoice Amount] |
CELLREGEXP | Search a Java table cell by its text regular expression. | [CELLREGEXP: Invoice.*] |
TABINDEX | Search a tab in a tabbed panel by its sequential number starting from 0. | [TABINDEX: 6] |