Playwright ariaSnapshot() can include element bounding boxes
Introduced 2026-05-11 · score 0.92
HOW TO USE IT
When inspecting a page or locator, pass `{ boxes: true }` to `ariaSnapshot()` to append each element’s bounding box as `[box=x,y,width,height]`.
await page.ariaSnapshot({ boxes: true });await page.getByRole('<role>').ariaSnapshot({ boxes: true });WHY THIS HELPS
Include element geometry in an aria snapshot used to inspect a page or locator.
REQUIREMENTS AND LIMITATIONS
- Version: v1.60.0
- boxes: Boolean option; when true, appends each element’s bounding box to the snapshot. Defaults to false. Coordinates are viewport-relative CSS pixels.
- Prerequisite: Use Playwright v1.60.0 or later; the `boxes` option was added in v1.60.
FIRST-PARTY EVIDENCE
- https://github.com/microsoft/playwright/releases/tag/v1.60.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