Skip to main content
Version: 10.2.9

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

CriteriaDescriptionExample
NAMEElement instance name.[NAME: Toolbar]
REGEXPNAMERegular expression for element instance name.[REGEXPNAME: \d{3}]
TITLEElement title.[TITLE: Notepad]
REGEXPTITLERegular expression for element title.[REGEXPTITLE: /[a-zA-Z]+/g]
CLASSElement class.[CLASS: JToggleButton]
REGEXPCLASSRegular expression for element class.[REGEXPCLASS: J.]
TEXTElement text property.[TEXT: Submit]
REGEXPTEXTRegular expression for element text property.[TEXT: S[a-z]]
INSTANCEUI control instance number.[INSTANCE: 42]
CSSjQuery-like CSS styles search in desktop UI tree controls. See more in Apply CSS selectors.[CSS: .JPanel.JButton]
XPATHXPath search in desktop UI tree controls. See Effective XPath for more details.[XPATH: //element[@class=Child3]/element[@class=JButton]]
TOOLTIPElement tooltip text for desktop applications.[TOOLTIP: Open]

Java-specific attributes

CriteriaDescriptionExample
PATHSpecify a path to a tree control element. Descendant texts are separated by a pipe.
LEVELSearch in a specific tree level by its sequential number starting from 0 (JTree, DTree, and so on).[LEVEL:3]
TEXT_LEVELSearch in a specific tree level by its text.[LEVEL:Quartets]
CELLSearch a Java table cell by its coordinates (row, column).[CELL:2,1]
CELLTEXTSearch a Java table cell by its text.[CELLTEXT: Invoice Amount]
CELLREGEXPSearch a Java table cell by its text regular expression.[CELLREGEXP: Invoice.*]
TABINDEXSearch a tab in a tabbed panel by its sequential number starting from 0.[TABINDEX: 6]