Expand description
Accessibility-tree snapshots with element refs.
This module is pure: it turns the JSON returned by CDP
Accessibility.getFullAXTree into a compact, Playwright-style YAML
listing that agents can read cheaply, and it hands out stable element
refs ([ref=eN]) that the native input path (crate::session::input)
resolves back to backendDOMNodeIds. Nothing here talks to a browser,
so every rule is unit-tested against canned tree fixtures.
Why the AX tree rather than an injected JS walker: Chromium’s
accessibility tree is already composed across shadow roots, carries the
computed accessible name/role the same way Playwright reports them, and
attaches a backendDOMNodeId per node — exactly the handle DOM.* and
Input.* accept. A DOM walker would have to reimplement accessible-name
computation and could not cross closed shadow roots.
Re-exports§
Modules§
- refs
- Per-tab element reference table.
Structs§
- AxNode
- One node of the accessibility tree, normalised from an
AXNode. - AxTree
- The whole tree, indexed by
nodeId. - Find
Options - Options for
find. - Match
- One
findhit. - Snapshot
- Rendered snapshot.
- Snapshot
Options - Rendering options for
render_snapshot.
Constants§
Functions§
- document_
token - Identity of the document the tree was taken from: the root
(
RootWebArea) node’sbackendDOMNodeId, which is the Document node. It changes on every navigation, so it doubles as a staleness token for refs.Nonewhen the tree carries no backend ids (mock/partial). - find
- Score every candidate node against a free-text query. Pure text
matching — no model call. Returns at most
opts.limitmatches, best first, ties broken by document order. - is_
interactive_ role - Roles that mean “the agent can act on this”.
- parse_
full_ ax_ tree - Parse a
Accessibility.getFullAXTreeresult ({ nodes: [...] }). - render_
snapshot - Render the tree as indented YAML-ish lines, interning refs as it goes.