Overview
Selects an option from a dropdown, combobox, or list by matching the option’s text value. This command searches for the specified value among the element’s children and selects it.Syntax
Parameters
Element reference from snapshot (must be a
combobox, popupbutton, or list)Text of the option to select (exact match or partial)
Response
Response Fields
The action performed (
select)The element reference where selection was made
Element state after selection
role(string): Element rolevalue(string): Selected option textstates(string[]): Current states
AX-First Strategy
The select command uses this approach:- Get element’s children/options via accessibility
- Find child matching the value text
- Click the matching option
- Verify selection via
kAXValueAttribute
Usage Examples
Select from Dropdown
Select from Popup Button
Select from List
Partial Match Selection
Supported Element Types
| Role | Behavior |
|---|---|
combobox | Opens dropdown and selects option |
popupbutton | Opens menu and clicks menu item |
list | Selects list item by value |
table | Selects row by cell content |
Selection Strategies
- Direct AX Selection: Sets
kAXSelectedChildrenAttribute - Click Option: Finds and clicks the matching option
- Keyboard Navigation: Uses arrow keys to navigate to option
Error Cases
| Error Code | Cause | Recovery |
|---|---|---|
ELEMENT_NOT_FOUND | Ref doesn’t exist or value not found | Verify option exists via snapshot |
STALE_REF | Element no longer matches saved ref | Run snapshot and use new ref |
ACTION_FAILED | Selection failed or option not clickable | Manually click dropdown then option |
INVALID_ARGS | Empty value or wrong element type | Provide valid option text |
Select Patterns
Two-Step Pattern (Open + Select)
One-Step Pattern (Direct Select)
Verifying Selection
Common Use Cases
- Form Fields: Select country, state, category
- Settings: Choose preferences from dropdowns
- Filters: Select filter values in search interfaces
- Lists: Select items from file/folder lists
Notes
- Value matching is typically case-sensitive
- Partial matches are supported in most implementations
- Some dropdowns must be opened with
clickfirst - Selection may trigger onChange events
- For multi-select lists, use multiple
selectcalls - Verify selection after command if critical
- Use
snapshotto see available options before selecting