snapshot command is the most powerful discovery tool, creating an annotated view of an application’s accessibility tree with element references that can be used for automation.
Overview
@n1, @n2) for each element, allowing you to interact with elements without writing complex selectors.
Arguments
string
required
Application name or bundle identifier
Options
boolean
Filter to show only interactive elements (buttons, inputs, etc.)
boolean
Remove empty structural elements with no labels, values, or actions
integer
default:"8"
Maximum depth to traverse in the element tree
boolean
Output as JSON instead of formatted text
Examples
Basic snapshot
Interactive elements only
Compact view
JSON output
Understanding snapshot output
Element format
Common roles
Button- Clickable buttonsTextField- Single-line text inputTextArea- Multi-line text inputCheckBox- Toggleable checkboxRadioButton- Radio buttonPopUpButton- Dropdown/select menuLink- Clickable linkTab- Tab in a tab barMenuItem- Menu itemWindow- Application windowScrollArea- Scrollable regionStaticText- Non-editable text
Actions
Actions shown in brackets indicate what operations are possible:AXPress- Can be clickedAXConfirm- Can be submitted (e.g., text fields)AXShowMenu- Can show a context menuAXRaise- Can be brought to frontAXIncrement/AXDecrement- Can be increased/decreased (sliders, steppers)AXPick- Can be selected (menu items)
State indicators
(disabled)- Element is not currently interactive= "value"- Element has a current value
Using references
References from snapshots can be used in other commands:Click buttons
Fill text fields
Check state
Get values
Interactive element types
With--interactive flag, these roles are included:
- Input elements
- Selection elements
- Adjustment elements
AXButtonAXTextFieldAXTextAreaAXSearchFieldAXSecureTextField