@@ -7,19 +7,41 @@ title: Snapshots
77Snapshots provide a structured view of the UI and generate stable refs.
88
99``` bash
10- agent-device snapshot -i
11- agent-device snapshot --backend xctest
12- agent-device snapshot --backend ax
10+ agent-device snapshot # Full accessibility tree
11+ agent-device snapshot -i # Interactive elements only (recommended)
12+ agent-device snapshot -c # Compact (remove empty elements)
13+ agent-device snapshot -d 3 # Limit depth to 3 levels
14+ agent-device snapshot -s " Contacts" # Scope to label/identifier
15+ agent-device snapshot -i -c -d 5 # Combine options
1316```
1417
15- Backends:
18+ | Option | Description |
19+ | ------------ | ------------------------- |
20+ | ` -i ` | Interactive-only output |
21+ | ` -c ` | Compact structural noise |
22+ | ` -d <depth> ` | Limit tree depth |
23+ | ` -s <scope> ` | Scope to label/identifier |
24+
25+ Note: If XCTest returns 0 nodes (foreground app changed), agent-device falls back to AX when available.
26+
27+ ## Example output:
1628
17- - ` xctest ` (default): full fidelity, no Accessibility permission required.
18- - ` ax ` : fast accessibility tree, may miss details.
29+ ``` bash
30+ agent-device snapshot -i
31+ # Output:
32+ # Snapshot: 44 nodes
33+ # @e1 [application] "Contacts"
34+ # @e2 [window]
35+ # @e3 [other]
36+ # @e4 [other] "Lists"
37+ # @e5 [navigation-bar] "Lists"
38+ # @e6 [button] "Lists"
39+ # @e7 [text] "Contacts"
40+ # @e8 [other] "John Doe"
41+ # @e9 [other] "John Doe"
42+ ```
1943
20- Tips :
44+ ## Backends (iOS) :
2145
22- - Use ` -i ` for interactive-only output.
23- - Use ` -c ` to compact structural noise.
24- - Use ` -d <depth> ` to limit depth.
25- - If XCTest returns 0 nodes (foreground app changed), agent-device falls back to AX when available.
46+ - ` xctest ` (default): full fidelity, fast, no Accessibility permission required.
47+ - ` ax ` : fast accessibility tree, may miss details, requires Accessibility permission.
0 commit comments