AccessibilitySnapshot.fromNode] (e.g. from
[Machine.focusedRoot]) or [AccessibilitySnapshot.fromWindow]. Render it
as
LLM-facing text with [AccessibilitySnapshot.toStringWith], resolve
indices back to live nodes with [AccessibilitySnapshot.node], and act
on elements by index via the action methods.
Indices are frozen at capture time and cover every node of the walk
(including collapsible wrappers), so the same snapshot can be printed
with different [SnapshotPrintOptions] without renumbering. A
consequence: rendering with collapseStructural produces
non-contiguous [ref=N] values, because skipped wrappers keep their
index.
Constructor
Returns
AccessibilitySnapshot
Properties
number
required
Number of captured nodes. Alias for [
AccessibilitySnapshot.len].Methods
activate()
index.
Parameters
number
required
boundingBox()
index — for example for a
coordinate-click fallback when a semantic action fails.
Parameters
number
required
Returns
BoundingBox
click()
index, dispatching to the platform action that
matches its current role:
- button / link / menuitem / img →
activate - tab / radio / option →
select - combobox / treeitem →
expandCollapse - checkbox / switch →
toggle - anything else →
activate
AccessibilitySnapshot.boundingBox].
Parameters
number
required
expandCollapse()
index.
Parameters
number
required
focusElement()
AccessibilitySnapshot.setFocus].
Parameters
number
required
fromNode()
node.
This is a full pre-order walk with no structural collapse and no
property reads. Filtering and formatting are deferred to
[AccessibilitySnapshot.toStringWith] so one capture can serve
several renderings.
Parameters
AccessibilityNode
required
Returns
AccessibilitySnapshot
fromWindow()
window’s accessibility subtree.
Parameters
Window
required
Returns
AccessibilitySnapshot
getBounds()
AccessibilitySnapshot.boundingBox].
Parameters
number
required
Returns
BoundingBox
isEmpty()
true if the snapshot holds no nodes.
Returns
boolean
len()
Returns
number
node()
Parameters
number
required
Returns
AccessibilityNode
print()
AccessibilitySnapshot.toStringWith].
Parameters
null | SnapshotPrintOptions
Returns
string
scrollIntoView()
index into view.
Parameters
number
required
select()
index.
Parameters
number
required
setFocus()
index (may also bring its window to the
foreground).
Parameters
number
required
setValue()
index.
Parameters
number
required
string
required
showMenu()
index — the semantic
equivalent of a right-click, without synthesizing pointer input, so
it works on background / obscured windows (Windows ShowContextMenu,
macOS AXShowMenu, Linux AT-SPI show-menu, Android long-press).
The opened menu itself typically appears as the topmost / focused
window even when the target window stays in the background — a user
watching the desktop sees a menu pop up without having done
anything.
Throws when the element does not support opening a menu this way;
callers can fall back to a coordinate right-click at the centre of
[AccessibilitySnapshot.boundingBox].
Parameters
number
required
toggle()
index.
Parameters
number
required
toStringWith()
[ref=N] markers:
maxChars), a #automation-id marker when the platform reports
one, the ref index, and a : "value" suffix for value-bearing roles.
Filtering is controlled by [SnapshotPrintOptions]; returns
"(empty)" when every node is filtered out.
Properties are read from the live elements on every call, so the text
reflects current UI state while ref numbering stays frozen.
Parameters
null | SnapshotPrintOptions
Returns
string
