Overview
Every interaction command targets an element by ref (e.g.,@e3) obtained from a prior snapshot. This ensures deterministic, accessibility-native control.
click
Click element via accessibility press action
double-click
Double-click to open files or select words
triple-click
Triple-click to select lines or paragraphs
right-click
Right-click to open context menu
type
Focus element and type text
set-value
Set value directly via accessibility attribute
clear
Clear element value to empty string
focus
Set keyboard focus on element
select
Select option in dropdown or list
toggle
Toggle checkbox or switch
check
Set checkbox to checked (idempotent)
uncheck
Set checkbox to unchecked (idempotent)
expand
Expand disclosure or tree item
collapse
Collapse disclosure or tree item
scroll
Scroll element in a direction
scroll-to
Scroll element into visible area
AX-First Philosophy
Every action follows a 15-step accessibility activation chain before resorting to mouse events:- Try
AXPressaction (native click) - Try
AXShowMenuaction (for menu buttons) - Try setting
AXFocused+ synthetic key press - Try
AXPerformActionwith target element - … (10 more strategies)
- Final fallback: mouse click at element center
Common Patterns
Click a Button
kAXPressAction if available. Returns success or falls back to mouse.
Type Into Text Field
Set Value Directly
For faster input without simulating keystrokes:kAXValueAttribute directly. Useful for bulk text replacement.
Clear Input Field
Toggle Checkbox
check or uncheck for idempotent operations:
Select Dropdown Option
Expand/Collapse Disclosure
Scroll Element
Scroll Element Into View
Right-Click for Context Menu
click @e1 to select a menu item.
Examples
Use Cases
Form Automation
Form Automation
Fill out forms using refs from snapshot:
File Management
File Management
Navigate Finder, select files, trigger actions:
Settings Configuration
Settings Configuration
Toggle preferences in System Settings:
Text Editing
Text Editing
Manipulate documents in TextEdit or Word:
Error Handling
Common error codes:STALE_REF: Element no longer matches the last snapshot. Runsnapshotto refresh refs.ACTION_FAILED: The OS rejected the action (element not actionable, wrong role, etc.)ELEMENT_NOT_FOUND: Ref doesn’t exist or element was removedACTION_NOT_SUPPORTED: Element doesn’t support the requested action