> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AccessibilityTree

# Class: AccessibilityTree

Defined in: [index.d.ts:114](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L114)

Accessibility tree bound to a specific window. Provides snapshot and
ref-based actions for desktop automation (Windows UIA).

## Constructors

### Constructor

> **new AccessibilityTree**(): `AccessibilityTree`

#### Returns

`AccessibilityTree`

## Accessors

### windowId

#### Get Signature

> **get** **windowId**(): `number`

Defined in: [index.d.ts:127](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L127)

Get the window handle as an integer ID.

##### Returns

`number`

***

### windowTitle

#### Get Signature

> **get** **windowTitle**(): `string`

Defined in: [index.d.ts:125](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L125)

Get the window title.

##### Returns

`string`

## Methods

### activate()

> **activate**(`refId`): `void`

Defined in: [index.d.ts:145](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L145)

Invoke/click an element (button, link, menuitem).

#### Parameters

##### refId

`number`

#### Returns

`void`

***

### clearRefs()

> **clearRefs**(): `void`

Defined in: [index.d.ts:163](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L163)

Clear all stored element refs.

#### Returns

`void`

***

### expandCollapse()

> **expandCollapse**(`refId`): `void`

Defined in: [index.d.ts:153](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L153)

Expand or collapse a dropdown or tree item.

#### Parameters

##### refId

`number`

#### Returns

`void`

***

### find()

> **find**(`order`, `role?`, `name?`, `visibleOnly?`, `maxResults?`, `collapseStructural?`): [`AccessibilityNodeJs`](../interfaces/AccessibilityNodeJs.mdx)\[]

Defined in: [index.d.ts:186](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L186)

Search the tree using the chosen traversal order.

* `order` – `TraversalOrder.DepthFirst` or `TraversalOrder.BreadthFirst`
* `role`  – keep nodes whose ARIA role equals this value
  (e.g. `AriaRole.Button`, `AriaRole.TabList`,
  `AriaRole.MenuBar`). Cross-platform ARIA roles, not
  the platform-native `UIA.ControlType.*` / `AX*` /
  `AT-SPI.Role.*` vocabulary.
* `name`  – keep nodes whose title or description contains this
  string
* `visible_only` – skip invisible nodes (default `false`)
* `max_results`  – stop after this many matches (uses `.take()`)
* `collapse_structural` – hoist empty structural wrappers (for example `Pane`
  / `Group` / `Custom` / `Document` on Windows, `AXGroup` /
  `AXGenericGroup` / `AXUnknown` on macOS, AT-SPI `Panel` /
  `Filler` / `Section` on Linux) out of the walk so role searches
  do not hit unnamed containers (default `false`)

Clears existing refs; returned nodes carry `refId` values usable
with action methods (`activate`, `setValue`, …).

#### Parameters

##### order

[`TraversalOrder`](../enumerations/TraversalOrder.mdx)

##### role?

[`AriaRole`](../enumerations/AriaRole.mdx) | `null`

##### name?

`string` | `null`

##### visibleOnly?

`boolean` | `null`

##### maxResults?

`number` | `null`

##### collapseStructural?

`boolean` | `null`

#### Returns

[`AccessibilityNodeJs`](../interfaces/AccessibilityNodeJs.mdx)\[]

***

### focusElement()

> **focusElement**(`refId`): `void`

Defined in: [index.d.ts:157](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L157)

Focus an element (brings window to foreground).

#### Parameters

##### refId

`number`

#### Returns

`void`

***

### getBounds()

> **getBounds**(`refId`): [`BoundingBox`](../interfaces/BoundingBox.mdx)

Defined in: [index.d.ts:159](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L159)

Get the live bounding box of an element.

#### Parameters

##### refId

`number`

#### Returns

[`BoundingBox`](../interfaces/BoundingBox.mdx)

***

### getSupportedActions()

> **getSupportedActions**(`refId`): `string`\[]

Defined in: [index.d.ts:161](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L161)

Get the list of supported actions for an element.

#### Parameters

##### refId

`number`

#### Returns

`string`\[]

***

### scrollIntoView()

> **scrollIntoView**(`refId`): `void`

Defined in: [index.d.ts:155](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L155)

Scroll an element into view.

#### Parameters

##### refId

`number`

#### Returns

`void`

***

### select()

> **select**(`refId`): `void`

Defined in: [index.d.ts:151](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L151)

Select a tab, radio button, or list item.

#### Parameters

##### refId

`number`

#### Returns

`void`

***

### setValue()

> **setValue**(`refId`, `value`): `void`

Defined in: [index.d.ts:147](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L147)

Set the text value of an element (textbox, combobox).

#### Parameters

##### refId

`number`

##### value

`string`

#### Returns

`void`

***

### snapshot()

> **snapshot**(`visibleOnly?`): [`AccessibilityNodeJs`](../interfaces/AccessibilityNodeJs.mdx)

Defined in: [index.d.ts:143](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L143)

Take a snapshot of the window's accessibility tree.

`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

##### visibleOnly?

`boolean` | `null`

#### Returns

[`AccessibilityNodeJs`](../interfaces/AccessibilityNodeJs.mdx)

***

### toggle()

> **toggle**(`refId`): `void`

Defined in: [index.d.ts:149](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L149)

Toggle a checkbox or switch.

#### Parameters

##### refId

`number`

#### Returns

`void`

***

### fromForeground()

> `static` **fromForeground**(): `AccessibilityTree`

Defined in: [index.d.ts:116](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L116)

Create an accessibility tree bound to the current foreground window.

#### Returns

`AccessibilityTree`

***

### fromHwnd()

> `static` **fromHwnd**(`hwnd`): `AccessibilityTree`

Defined in: [index.d.ts:123](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L123)

Create an accessibility tree from a platform-specific window identifier.
On Windows this is an HWND; on macOS it is a PID.

#### Parameters

##### hwnd

`number`

#### Returns

`AccessibilityTree`

***

### fromPid()

> `static` **fromPid**(`pid`): `AccessibilityTree`

Defined in: [index.d.ts:118](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L118)

Create an accessibility tree bound to the first visible window of a process.

#### Parameters

##### pid

`number`

#### Returns

`AccessibilityTree`
