import { Accessibility } from "https://deno.land/x/pptr@1.2.0/src/Accessibility.ts";
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 = [UNSUPPORTED]Returns
Promise<SerializedAXNode>
An AXNode object representing the snapshot.