October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Configure Accessibility Snapshots in Puppeteer

Capture Puppeteer’s accessibility tree and tune node filtering, iframe inclusion, and subtree scope with practical code examples.
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. 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.

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

Configure what the snapshot includes

The options control tree filtering, iframe coverage, and the subtree used as the root.

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:

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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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: true for a compact tree when omitted nodes are not relevant to your inspection.
  • Use interestingOnly: false to investigate pruning or inspect more of Blink’s accessibility representation.
  • Set includeIframes: true when required content is in frames; it does not enable itself by default.
  • Pass root when 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:

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.

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

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
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

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.

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

The 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:

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.