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

How to Use Puppeteer’s Accessibility API

Inspect Puppeteer’s serialized accessibility tree, tune snapshot detail and scope, and use ARIA locators when you need to interact with controls by name and role.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use await page.accessibility.snapshot() to inspect the accessibility tree Puppeteer receives from the page. The result is a serialized tree rooted at the page, or null; it is useful for checking accessible names, roles and states, but it is not a visual DOM dump or a guarantee of what every screen reader announces.

Take a page accessibility snapshot

After navigating to a page in Puppeteer, call and await page.accessibility.snapshot():

As an Amazon Associate I earn from qualifying purchases.

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

The promise resolves to a SerializedAXNode or null. Handle the null case before traversing the result. The current Puppeteer API reference documents this method and its options: Accessibility.snapshot().

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

Choose how much of the tree to include

The snapshot options control which nodes are retained and what part of the page is covered:

Option Default Effect
interestingOnly true Prunes nodes Puppeteer considers uninteresting. Set to false to request a fuller tree.
root Full page Uses an ElementHandle<Node> as the snapshot root instead of the page.
includeIframes false Includes accessibility trees for iframes in the frame subtree when enabled.

Chrome’s accessibility tree can contain nodes unused by many platforms and screen readers, so Puppeteer prunes nodes by default. To inspect more of that tree and include iframe content:

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

To narrow the capture to an element, obtain its handle and pass it as root. If TypeScript or editor diagnostics reject an option or handle type, check the type definitions for the Puppeteer version installed in the project.

Rank #2
Sale
Color Test Book with Ishihara Color Chart Plates for Vision Screening and Deficiency Detection Portable Eye Testing Chart for Drivers and Home Use
  • Core Functionality: This color test book provides a comprehensive and user-friendly color chart designed specifically for early detection of color deficiency, facilitating timely intervention and safer driving assessments
  • Material and Design: Crafted from stable, lightweight, and durable materials, this test book offers convenience and longevity for repeated use in various settings
  • Language and Accessibility: Designed in english to ensure easy understanding and accurate self-administration of the color test book by english-speaking users, enhancing usability and testing accuracy
  • Portability and Storage: Compact dimensions of approximately 3.81 by 3.34 by 0.11 inches and lightweight construction make this test book highly portable and easy to store for use in clinics, schools, or at home
  • Practical Application: Ideal for use in various scenarios such as driver screening, vision examinations, and color deficiency assessments, this color test book integrates multiple test charts to support thorough visual evaluations

Read and traverse the serialized result

A serialized accessibility node contains a role, a computed name, child nodes and other accessibility properties. Depending on the node, properties such as description, checked, disabled and busy may be present or absent. Treat those fields as optional rather than assuming every node has the same shape; the SerializedAXNode interface lists the documented fields.

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

For example, this traversal finds a node marked as focused and safely handles both a null snapshot and nodes without children:

function findFocusedNode(node) {
  if (!node) return null;
  if (node.focused) return node;
  for (const child of node.children ?? []) {
    const found = findFocusedNode(child);
    if (found) return found;
  }
  return null;
}

const snapshot = await page.accessibility.snapshot();
const focusedNode = snapshot && findFocusedNode(snapshot);
console.log(focusedNode?.name);

A missing focused node is not evidence that the page has no focusable controls; it means this traversal did not find a node marked focused in this snapshot.

Use snapshots to inspect; use ARIA locators to act

A snapshot is best for examining the structured accessibility representation. If you want to click or fill a control by its computed accessible name and role, use Puppeteer’s locator API instead. Its ARIA selector resolves relationships such as labelledby before querying:

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

For a control identified by its accessible name, the shorter form can be more convenient:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.locator('::-p-aria(Search)').fill('automate beyond recorder');

Locators wait for action conditions such as visibility and enabled state, making them a better fit for interaction than extracting a snapshot and manually locating a node. See Puppeteer’s page interaction guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Know what the snapshot does—and does not—represent

Puppeteer exposes Blink’s accessibility tree. As the Accessibility class documentation puts it, “Accessibility is a very platform-specific thing.” A browser’s tree is translated into platform APIs, and an operating system or assistive technology may filter it further. A Puppeteer snapshot therefore cannot establish exactly what every screen reader will announce. For user-facing accessibility testing, validate with the relevant browser, operating system and assistive technology as well.

Version considerations

The current API reference and guide consulted for this article identify Puppeteer 25.12.0. The changelog records an accessibility snapshot enhancement in version 24.37.0, dated February 4, 2026. APIs and serialized properties can change; use the documentation and type definitions matching the version installed in your project. The documented call shown here is page.accessibility.snapshot().

Or skip the browser setup

If your goal is a page screenshot rather than accessibility-tree inspection, ScreenshotNeo is a website screenshot API and MCP server for developers. A single GET request returns an image or PDF; for example, using cURL:

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.
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. It accepts cookie or consent banners and removes known consent platforms, newsletter popups and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits cost nothing, and response headers report the page verdict and whether the shot was billed. Its MCP server lets AI agents use screenshot, page-info and PDF-capture tools. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for the free plan.

Frequently Asked Questions

Does a Puppeteer accessibility snapshot include iframes by default?

No. Set includeIframes: true to include accessibility trees for iframes in the frame subtree.

Can I use an accessibility snapshot as a complete screen-reader test?

No. It represents Blink’s accessibility tree; platform APIs and assistive technologies may transform or filter that information.

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
Crashes, No Sound, or Screen Glitches?Free driver scan
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.