Playwright aria snapshots support page capture and locator depth and mode options
Introduced 2026-04-01 · score 0.96
HOW TO USE IT
When inspecting accessible structure in browser tests, capture a page snapshot with `page.ariaSnapshot()` or call `locator.ariaSnapshot({ depth, mode })` to limit snapshot depth or choose its mode.
const snapshot = await page.ariaSnapshot();const snapshot = await locator.ariaSnapshot({ depth: <depth>, mode: '<default-or-ai>' });WHY THIS HELPS
When inspecting accessible structure in browser tests, capture a page snapshot or set snapshot depth and mode on a locator.
REQUIREMENTS AND LIMITATIONS
- Version: v1.59.0
- depth: Number; when specified, limits snapshot depth.
- mode: `"ai"` returns an AI-optimized snapshot; `"default"` is the default mode. The modes are alternatives.
- `page.ariaSnapshot()` is equivalent to `page.locator('body').ariaSnapshot()`.
- Docs conflict: Current API docs show `page.ariaSnapshot()` added in v1.59 and locator `depth`/`mode` added in v1.59; docs also describe features added in later versions, which are omitted here.
FIRST-PARTY EVIDENCE
- https://github.com/microsoft/playwright/releases/tag/v1.59.0
- https://playwright.dev/docs/api/class-page#page-aria-snapshot
- https://playwright.dev/docs/api/class-locator#locator-aria-snapshot
Check the installed version and the source before using it. Entry JSON