What are Accessibility Snapshots?
Accessibility snapshots are structured representations of web page content based on the browser’s accessibility tree. Instead of sending screenshots to LLMs, Playwright MCP captures the semantic structure of the page in a text format that includes:- Element roles (button, link, heading, etc.)
- Accessible names (visible labels)
- Element states (checked, disabled, expanded)
- Text content
- Interactive elements only (no decorative content)
Why Snapshots Beat Screenshots
Playwright MCP takes an accessibility-first approach to page representation:Screenshots
Visual pixel data✗ Large file sizes (100KB - 5MB)✗ Requires vision models✗ Imprecise coordinate guessing✗ Slow to process✗ Affected by layout changes
Accessibility Snapshots
Structured text data✓ Small size (5KB - 50KB)✓ Works with standard LLMs✓ Precise element references✓ Fast to process✓ Layout-independent
Token Efficiency
Accessibility snapshots are dramatically more efficient:This token efficiency is why Playwright MCP is described as “Fast and lightweight” - it uses structured data instead of pixel-based input.
Snapshot Structure
Here’s an example of what an accessibility snapshot looks like:Key Components
Element Roles The accessibility role describes what an element is:button- Clickable buttonlink- Hyperlinktextbox- Text input fieldcheckbox,radio- Selection controlsheading- Heading (with level attribute)list,listitem- Listsmenu,menuitem- Menus
Element References (ref parameter)
The[ref=N] attribute is the most important part of snapshots - it provides a stable reference to interact with elements.
How References Work
Each interactive element in the snapshot gets a unique reference number:The
element parameter is a human-readable description for permission prompts. The ref parameter is the exact element reference from the snapshot.Why References are Better Than Selectors
Traditional selector approach:- Stable - Based on semantic structure, not implementation details
- Resilient - Work across layout changes
- Unambiguous - Exact element targeting
- Fast - Direct element lookup
Reference Lifetime
References are valid for the current snapshot:Snapshot Modes
Playwright MCP supports three snapshot modes:Incremental Mode (Default)
Only returns changes since the last snapshot:- Minimal token usage
- Fast processing
- Shows what changed
- Performing multi-step workflows
- Making incremental changes
- Token efficiency matters
Full Mode
Returns the complete accessibility tree every time:- Complete context
- No dependency on previous state
- Easier to reason about
- Starting new task sequences
- Debugging issues
- Context is more important than tokens
None Mode
Disables automatic snapshots:- You only need specific data (not full page structure)
- Building custom tools
- Optimizing for specific workflows
browser_snapshot().
Example Snapshot Workflow
Here’s how an LLM uses snapshots to fill out a login form: Step 1: Get initial snapshotSnapshot Filtering
Accessibility snapshots automatically filter out:- Decorative elements - Images without alt text, spacers, dividers
- Hidden elements -
display: none,visibility: hidden - Aria-hidden elements - Explicitly hidden from screen readers
- Presentation roles - Elements marked as presentational
- Redundant text - Duplicate content, whitespace
Combining with Screenshots
While snapshots are preferred, screenshots can be useful for:- Visual verification
- Debugging layout issues
- Capturing images and graphics
- Complex visual elements
Advanced: Snapshot Optimization
Test ID Attributes
Use test IDs for more stable element targeting:Snapshot to File
Save snapshots to files instead of returning inline:Console and Network Logs
Capture additional context:Best Practices
Do
- Use snapshots for all interactions
- Store refs from latest snapshot
- Use incremental mode for efficiency
- Request new snapshot after navigation
- Use descriptive element names
Don't
- Don’t try to interact based on screenshots
- Don’t reuse refs from old snapshots
- Don’t parse snapshots manually
- Don’t request snapshots unnecessarily
- Don’t ignore accessibility attributes
Next Steps
Tool Reference
Explore all available browser automation tools
Browser Automation
Learn about browser automation concepts

