Editing the UI Automation Selector Syntax

To uniquely identify a control in a program (ui)

The query must always start with [ui.]

Syntax

Purpose

Example

Behavior and Logic

c[index]

Identifies control by index in parent

ui.c[3].c[5].c[0]

Selects window (ui.) > forth child (c[3]), sixth child (c[5]), and first child (c[0])

n(Name)

Identifies control by name

ui.n(Delete).c[5]

Selects window (ui.) > element with name “Delete” > element's sixth child

t(Type)

Identifies control by type

ui.t(Pane).n(BuyMe)

Selects window (ui.) > element with type “Pane” > control with name “BuyMe”

l(Classname)

Identifies control by className

ui.l(TDBPane)

Selects window (ui.) > element with className “TDBPane”

Different platforms have different ClassName. For example, in delphi button it is called TButton, while in QT it’s called QTButton.

The selection performs a full tree search and it also knows how to go back in a middle of a query and select another path to traverse. For example, a tree might have these elements:

  • Window

  • Checkbox

  • Pane

  • Button

The query .ui.t(Pane).t(Button) works. The internal control finder returns back to search another 'Pane' once it sees the “Checkbox”.