Overview
Clicks an element using the AX-first activation strategy. The command exhausts pure accessibility API methods before falling back to mouse events, ensuring maximum compatibility across applications.Syntax
Parameters
Element reference from snapshot (
@e1, @e2, etc.)Response
Response Fields
The action performed (
click)The element reference that was clicked
Element state after the action
role(string): Element rolestates(string[]): Current element statesvalue(string): Current element value
AX-First Strategy
The click command follows a 15-step activation chain:- Try
kAXPressActionon the element - Try focus + return key
- Try clicking parent elements
- Fall back to mouse click at element center
Usage Examples
Click a Button
Click and Chain Actions
Batch Click
Error Cases
| Error Code | Cause | Recovery |
|---|---|---|
ELEMENT_NOT_FOUND | Ref doesn’t exist in current refmap | Run snapshot to refresh |
STALE_REF | Element no longer matches saved ref | Run snapshot and use new ref |
ACTION_FAILED | Element doesn’t support press action | Try set-value or coordinate-based click |
PERM_DENIED | Accessibility permission not granted | Grant permission in System Settings |
Notes
- Click is idempotent for most buttons but may trigger side effects
- For form submissions, prefer clicking the submit button over pressing return
- Use
double-clickfor file selection,triple-clickfor text selection - Refs are snapshot-scoped; always refresh after UI changes