Constructor
Returns
AccessibilityTree
Properties
string
required
Get the window title (empty when it cannot be resolved).For an application-scoped tree (macOS
fromInstance) this is the
title of the application’s first window.Methods
activate()
Parameters
number
required
clearRefs()
expandCollapse()
Parameters
number
required
find()
order–TraversalOrder.DepthFirstorTraversalOrder.BreadthFirstrole– keep nodes whose ARIA role equals this value (e.g.AriaRole.Button,AriaRole.TabList,AriaRole.MenuBar). Cross-platform ARIA roles, not the platform-nativeUIA.ControlType.*/AX*/AT-SPI.Role.*vocabulary.name– keep nodes whose title or description contains this stringvisible_only– skip invisible nodes (defaultfalse)max_results– stop after this many matches (uses.take())collapse_structural– hoist empty structural wrappers (for examplePane/Group/Custom/Documenton Windows,AXGroup/AXGenericGroup/AXUnknownon macOS, AT-SPIPanel/Filler/Sectionon Linux) out of the walk so role searches do not hit unnamed containers (defaultfalse)
refId values usable
with action methods (activate, setValue, …).
Parameters
TraversalOrder
required
null | AriaRole
null | string
null | boolean
null | number
null | boolean
Returns
AccessibilityNodeJs[]
findByDescription()
overallDescription
(AXNodeSynthetic::summary_with_context) is exactly equal to
description, walked in pre-order depth-first.
Clears existing refs; returned nodes carry refId values usable
with the action methods (activate, setValue, …).
Parameters
string
required
Returns
AccessibilityNodeJs[]
focusElement()
Parameters
number
required
fromInstance()
Machine.foregroundApp], [App.open], …). The instance
carries its machine, so the tree targets whatever machine — local
desktop or Android — the instance came from.
The target is resolved once at construction time — subsequent
snapshots keep targeting it even if the user switches away.
Scope differs by platform (historical behavior): for a local
instance on macOS the tree covers the whole application (every
window plus the app menu bar); everywhere else it covers the
instance’s first visible top-level window (Android: the app’s first
live task). Use [AccessibilityTree.fromWindow] for guaranteed
window scoping.
Parameters
Instance
required
Returns
AccessibilityTree
fromWindow()
AccessibilityTree.fromInstance] — which on macOS scopes to
the whole application (every window plus the app menu bar) — this
scopes to exactly the given window’s subtree on every
platform. Use it to measure “is this element unique within this
window”, or to snapshot / act on one window of a multi-window app.
The window handle stores a persistent identity, so each snapshot
re-resolves fresh data for that same window; the handle can go stale
if the window is destroyed and recreated.
Parameters
Window
required
Returns
AccessibilityTree
getBounds()
Parameters
number
required
Returns
BoundingBox
getSupportedActions()
Parameters
number
required
Returns
string[]
scrollIntoView()
Parameters
number
required
select()
Parameters
number
required
setValue()
Parameters
number
required
string
required
showMenu()
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 center of
[AccessibilityTree.getBounds].
Parameters
number
required
snapshot()
BuildUpdatedCache IPC; the recursive walk
over children and properties then stays entirely in-process, ~40×
faster than walking a live root.
visible_only (default false) controls whether nodes whose
non-standard AXVisible attribute reads false are dropped from
the result.
AXVisible is a Chromium-specific extension; native macOS apps
don’t expose it, so the filter only matters for browser windows.
Chrome reports many web-content nodes (including AXLink) as
AXVisible=false because its accessibility-tree visibility is
compositor-driven, not pixel-driven — setting visible_only=true
on a Chrome window will silently drop most of the page including
links.
Parameters
null | boolean
Returns
AccessibilityNodeJs
toggle()
Parameters
number
required

