import { CodeBlock } from "@/components/code-block"; export default function Snapshots() { return (
The snapshot command returns a compact accessibility tree with refs for element interaction.
Filter output to reduce size:
| Option | Description |
|---|---|
-i, --interactive |
Only interactive elements (buttons, links, inputs) |
-C, --cursor |
Include cursor-interactive elements (cursor:pointer, onclick, tabindex) |
-c, --compact |
Remove empty structural elements |
-d, --depth |
Limit tree depth |
-s, --selector |
Scope to CSS selector |
Many modern web apps use custom clickable elements (divs, spans) instead of standard buttons or links.
The -C flag detects these by looking for:
cursor: pointer CSS styleonclick attribute or handlertabindex attribute (keyboard focusable)The default text output is compact and AI-friendly:
Refs from the snapshot map directly to commands:
Refs are invalidated when the page changes. Always re-snapshot after navigation or DOM updates:
-i to reduce output to actionable elements-s for specific page sections-d to limit depth on complex pagesFor programmatic parsing in scripts:
Note: JSON uses more tokens than text output. The default text format is preferred for AI agents.