Snapshots
Snapshots provide a structured view of the UI and generate stable refs.
Note: If XCTest returns 0 nodes (foreground app changed), agent-device fails explicitly. It does not automatically switch to AX.
Efficient snapshot usage
- Default to
snapshot -ifor agent loops. - Add
-s "<label>"(or-s @ref) to keep results screen-local. - Add
-d <depth>when you only need upper hierarchy layers. - Re-snapshot after any UI mutation before reusing refs.
- Use
diff snapshotbetween mutations to validate structural changes with lower output volume. - Keep
--rawfor troubleshooting only.
diff snapshot behavior:
- First run initializes baseline (
baselineInitialized: truein JSON). - Later runs return unified-style lines (
+added,-removed, unchanged context) and update baseline after each call.
Example output:
Backends (iOS):
xctest(default): full fidelity, fast, no Accessibility permission required.ax: fast accessibility tree, may miss details, requires Accessibility permission; simulator-only.
