Use await page.accessibility.snapshot() to capture Puppeteer’s current accessibility tree. Pass options to include otherwise-pruned nodes, request iframe trees, or limit the snapshot to an element subtree.
Capture a page accessibility snapshot
After navigating to a page, call snapshot() on the Puppeteer Page object. The method returns a promise that resolves to a serialized accessibility node or null.
As an Amazon Associate I earn from qualifying purchases.
const snapshot = await page.accessibility.snapshot();
console.log(snapshot);
The documented API reference is for Puppeteer 25.12.0. Check the reference for the version installed in your project if its API differs.
Configure what the snapshot includes
The options control tree filtering, iframe coverage, and the subtree used as the root.
#1 Best Overall
| Option | Default | When to use it |
|---|---|---|
interestingOnly |
true |
Set to false when you need nodes that Puppeteer would otherwise prune. |
includeIframes |
false |
Set to true when relevant content is inside frames and you want to request trees for each iframe in the frame subtree. |
root |
Whole page | Pass an ElementHandle<Node> to scope the result to that element’s subtree. |
Include all nodes Puppeteer exposes
By default, Puppeteer removes Chrome accessibility-tree nodes it says go unused on most platforms and by most screen readers. For a broader Blink tree, turn off that filtering:
const snapshot = await page.accessibility.snapshot({
interestingOnly: false,
});
Include iframe trees
Iframe trees are excluded by default. Enable them when the content you need to inspect is embedded in frames:
Rank #2
const snapshot = await page.accessibility.snapshot({
includeIframes: true,
});
Scope the snapshot to an element
Use an element handle as root when you only need a section rather than the entire page. For example, locate a container and pass its handle:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →const root = await page.$('main');
const snapshot = root
? await page.accessibility.snapshot({ root })
: null;
console.log(snapshot);
The root option accepts an element handle; the documented reference does not provide a specific locator example. The null check handles the case where the selector finds no matching element.
Combine options
Options can be combined when the task calls for a broad tree that includes frames:
const snapshot = await page.accessibility.snapshot({
interestingOnly: false,
includeIframes: true,
});
Choose the right snapshot scope
- Keep
interestingOnly: truefor a compact tree when omitted nodes are not relevant to your inspection. - Use
interestingOnly: falseto investigate pruning or inspect more of Blink’s accessibility representation. - Set
includeIframes: truewhen required content is in frames; it does not enable itself by default. - Pass
rootwhen only one element subtree matters, rather than processing the whole page.
Snapshot versus ARIA selectors
A snapshot serializes an accessibility tree for inspection. An ARIA selector is for locating and interacting with a particular element by its computed accessible name and role. For example:
Rank #4
await page.locator('::-p-aria([name="Click me"][role="button"])').click();
Puppeteer’s guide notes that ARIA relationships such as aria-labelledby are resolved before the selector query runs. Use a selector to find or operate a control; use snapshot() when you need the tree.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Interpret the result carefully
Puppeteer exposes Blink’s accessibility tree and approximates filtering for platform accessibility trees. Accessibility behavior varies by platform, so a Puppeteer 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 testing with relevant screen readers and platforms.
Best Value
- Used Book in Good Condition
Troubleshoot common snapshot issues
Expected nodes are missing
The default interestingOnly: true filters nodes. Try interestingOnly: false to check whether pruning explains the omission.
Content inside a frame is absent
includeIframes defaults to false. Set it to true if you need iframe trees.
The snapshot is larger than needed
Pass an element handle through root to inspect only that subtree. If the result still includes more nodes than expected, remember that interestingOnly: false disables Puppeteer’s pruning.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteThe result is null
The documented return type permits null. Check the value before traversing it, and when using root, verify that the element was found and is the subtree you intended to inspect.
Or skip the browser setup
If your goal is a page image or PDF rather than an accessibility tree, ScreenshotNeo takes a website screenshot with one GET request. For example, save a WebP screenshot of Stripe:
Quick Recap
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 API documentation for request details. Before capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.
Sign up for the free plan to try it.
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.
Recommended Free Tools




