~4 min8 / 16

Selectors

Selectors are XML strings that uniquely identify a UI element on screen. Genzbots uses a UiPath-style multi-segment format: one segment per level of the UI hierarchy, from the application window down to the target control.

Selector Format

workflow
1<wnd app='notepad.exe' title='Untitled - Notepad'/>
2<ctrl name='Text Editor' controltype='Edit'/>

Each <wnd> segment identifies a window; each <ctrl> identifies a control inside it. Web elements use <webctrl> with HTML/CSS attributes.

Attribute Priority (most → least reliable)

AttributeDescriptionExample
automationidUIA AutomationId — most stable, rarely changesautomationid="btnSubmit"
controltypeUIA control type (Button, Edit, List, etc.)controltype="Button"
roleARIA role (web elements)role="button"
classWindow class or CSS classclass="TextBox"
nameControl name — use prefix ^ or contains ~ for dynamic namesname="Submit"
idxZero-based positional index — avoid if possible, breaks on UI changesidx="2"
tagHTML element tag (web)tag="input"
idHTML id attribute (web)id="username"

Name Matching Operators

OperatorSyntaxMeaning
Exactname="Submit"Exact case-insensitive match
Starts-withname="^Invoice"Name begins with "Invoice"
Containsname="~Report"Name contains "Report" anywhere

Indicating an Element

  1. Click a UI activity (Click, Type Into, Get Text, etc.) on the canvas
  2. In the Properties Panel, click the 🎯 Indicate Element button next to the Selector field
  3. Studio minimises; hover over the target element — a blue highlight appears
  4. Click to capture. Studio resumes and the Selector field is auto-filled
  5. A Verified ✓ badge appears if the element was immediately confirmed on screen

For web elements, Studio auto-attaches to the running browser via CDP (Chrome DevTools Protocol), queries the DOM at your cursor position, and captures HTML attributes that match what the executor will use.

Selector Editor

Click Open Selector Editor (pencil icon) to fine-tune a captured selector:

  • Attribute table — check/uncheck individual attributes; remove fragile ones like idx
  • Re-indicate Element — re-capture from the live application
  • Validate — resolves the selector against the running application and shows a ✓ or ✗ with details
  • Highlight — flashes the matched element on screen so you can confirm it is the right one

Multi-Segment Selectors

For complex hierarchies (e.g., a control inside a panel inside a dialog), Studio generates up to 4–5 segments. At runtime, ElementFinder walks the UIA tree matching each segment in order — reducing false matches in applications with identical control names in multiple windows.

Selector Stability TipsAlways prefer automationid over positional idx. For dynamic titles (e.g., file names in the window title), use ~ contains matching. Validate selectors after every application update to catch regressions early.
Was this helpful?