Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use await page.accessibility.snapshot() to capture Puppeteer’s current accessibility tree. Configure interestingOnly to control pruning, includeIframes to include frame trees, and root to limit the snapshot to an element subtree. In Puppeteer 25.12.0, the call returns a promise that resolves to a serialized accessibility node or null.

Take a basic accessibility snapshot

After navigating to the page you want to inspect, call snapshot() on the Puppeteer page:

const snapshot = await page.accessibility.snapshot();
console.log(snapshot);

The result represents the root of the page’s serialized accessibility tree. It can be null when there is no root accessible node to return. Puppeteer’s API reference for version 25.12.0 documents this method and its configuration options: Puppeteer Accessibility.snapshot() API.

Configure what the snapshot includes

Pass an options object to adjust the snapshot’s coverage and scope. The defaults are a whole-page tree, pruned to interesting nodes, without iframe trees.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Option Default Set it when
interestingOnly true You want to retain nodes Puppeteer would otherwise prune; set it to false.
includeIframes false Relevant content is in frames and you want to request their accessibility trees; set it to true.
root The whole page You need a subtree; pass an ElementHandle for the root node.

For example, this requests all nodes rather than only interesting ones and includes iframe trees:

const snapshot = await page.accessibility.snapshot({
  interestingOnly: false,
  includeIframes: true,
});

Choose compact or more complete output

With the default interestingOnly: true, Puppeteer discards Chrome accessibility-tree nodes that are unused on most platforms and by most screen readers. This makes the result more compact. Set interestingOnly: false when investigating whether pruning omitted a node or when you need the fuller Blink accessibility representation.

Include iframe content when needed

Iframe trees are excluded by default. Set includeIframes: true when the content you need to inspect lives in frames. This option requests accessibility trees for each iframe in the frame subtree; it does not change the default scope from the whole page.

Limit the tree to an element

To scope the result, provide an ElementHandle as root. The API reference documents this option, but does not include a root-scoping example. Obtain a handle for the element you want to inspect and pass it in the options object:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const root = await page.$('#main-content');
const snapshot = await page.accessibility.snapshot({ root });

Make sure the selector matches an element before using it as the root. If it does not, page.$() returns null; handle that case rather than passing a missing handle.

Use a snapshot or an ARIA selector?

These solve different problems. A snapshot retrieves a serialized accessibility tree for inspection. Puppeteer’s ::-p-aria(...) selector locates an element by its computed accessible name and role, making it useful for interaction. For example:

await page.locator('::-p-aria([name="Click me"][role="button"])').click();

ARIA relationships such as aria-labelledby are resolved before the selector query runs. Use an ARIA selector when you need to find and operate a control; use snapshot() when you need to inspect the tree. See Puppeteer’s Accessibility attributes guide.

Interpret the result carefully

Puppeteer exposes Blink’s accessibility tree and approximates filtering for platform accessibility trees. Accessibility output is platform-specific, so the snapshot does not prove exactly what every operating system or assistive technology will announce. Treat it as a browser-side inspection aid, not a substitute for checking the experience with the relevant platform and assistive technology.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
The SQL Programming Language: .
  • Used Book in Good Condition
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common snapshot issues

  • A node is missing: The default interestingOnly: true prunes nodes. Retry with interestingOnly: false to see whether pruning explains the omission.
  • Frame content is absent: Iframe trees are off by default. Request them with includeIframes: true.
  • The result is larger than needed: Pass an element handle as root to scope the snapshot to a subtree.
  • The snapshot is null: The method’s return type permits null; check that the page has loaded the content you expect and that an accessible root node is available.
  • A screen reader announces something different: A Puppeteer snapshot reflects Blink’s tree and approximated filtering, not the exact output of every platform accessibility API or screen reader. Verify behavior in the target environment.

Or skip the browser setup

If you need a visual screenshot rather than a serialized accessibility tree, ScreenshotNeo provides a screenshot API and MCP server. Its one-call GET endpoint can return an image or PDF; it does not replace Puppeteer’s accessibility snapshot.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for API details. Before a capture, it accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Frequently Asked Questions

What does Puppeteer’s accessibility snapshot return?

A promise resolving to a serialized accessibility node for the tree root, or null.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can a Puppeteer snapshot confirm what a screen reader will say?

No. It exposes Blink’s accessibility tree; platform accessibility output and screen-reader behavior can differ.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.