Skip to main content
The 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

Snapshot generates unique references (like @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

Output:

Interactive elements only

Shows only elements users can interact with:

Compact view

Removes structural containers:

JSON output

Output:

Understanding snapshot output

Element format

Common roles

  • Button - Clickable buttons
  • TextField - Single-line text input
  • TextArea - Multi-line text input
  • CheckBox - Toggleable checkbox
  • RadioButton - Radio button
  • PopUpButton - Dropdown/select menu
  • Link - Clickable link
  • Tab - Tab in a tab bar
  • MenuItem - Menu item
  • Window - Application window
  • ScrollArea - Scrollable region
  • StaticText - Non-editable text

Actions

Actions shown in brackets indicate what operations are possible:
  • AXPress - Can be clicked
  • AXConfirm - Can be submitted (e.g., text fields)
  • AXShowMenu - Can show a context menu
  • AXRaise - Can be brought to front
  • AXIncrement/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:
  • AXButton
  • AXTextField
  • AXTextArea
  • AXSearchField
  • AXSecureTextField

Workflow patterns

Agent automation workflow

Testing workflow

Debugging workflow

Tips

Use --interactive --compact together for the cleanest output focused on actionable elements.
References are stored temporarily. If you restart the CLI, you’ll need to create a new snapshot.
For dynamic UIs, take a new snapshot after major state changes to get fresh references.
References are specific to the current app state. If the UI changes significantly, existing refs may become invalid.
  • find - Search for specific elements
  • tree - View full hierarchy without refs
  • inspect - View detailed element information
  • click - Click elements using refs
  • fill - Fill text fields using refs