import { Accessibility } from "https://dotland.deno.dev/x/puppeteer@16.2.0/vendor/puppeteer-core/puppeteer/common/Accessibility.js";
Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page.
Examples
An example of dumping the entire accessibility tree:
An example of dumping the entire accessibility tree:
const snapshot = await page.accessibility.snapshot();
console.log(snapshot);
An example of logging the focused node's name:
An example of logging the focused node's name:
const snapshot = await page.accessibility.snapshot();
const node = findFocusedNode(snapshot);
console.log(node && node.name);
function findFocusedNode(node) {
if (node.focused) return node;
for (const child of node.children || []) {
const foundNode = findFocusedNode(child);
return foundNode;
}
return null;
}
Parameters
optional
options: SnapshotOptions