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
| 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)
| Attribute | Description | Example |
|---|---|---|
automationid | UIA AutomationId — most stable, rarely changes | automationid="btnSubmit" |
controltype | UIA control type (Button, Edit, List, etc.) | controltype="Button" |
role | ARIA role (web elements) | role="button" |
class | Window class or CSS class | class="TextBox" |
name | Control name — use prefix ^ or contains ~ for dynamic names | name="Submit" |
idx | Zero-based positional index — avoid if possible, breaks on UI changes | idx="2" |
tag | HTML element tag (web) | tag="input" |
id | HTML id attribute (web) | id="username" |
Name Matching Operators
| Operator | Syntax | Meaning |
|---|---|---|
| Exact | name="Submit" | Exact case-insensitive match |
| Starts-with | name="^Invoice" | Name begins with "Invoice" |
| Contains | name="~Report" | Name contains "Report" anywhere |
Indicating an Element
- Click a UI activity (Click, Type Into, Get Text, etc.) on the canvas
- In the Properties Panel, click the 🎯 Indicate Element button next to the Selector field
- Studio minimises; hover over the target element — a blue highlight appears
- Click to capture. Studio resumes and the Selector field is auto-filled
- 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.
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.