> ## 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

> Accessibility tree bound to a specific window.

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

## Constructor

```typescript
AccessibilityTree(): AccessibilityTree
```

### Returns

`AccessibilityTree`

## Properties

<ResponseField name={"windowId"} type={"number"} required>
  Get the window handle as an integer ID.
</ResponseField>

<ResponseField name={"windowTitle"} type={"string"} required>
  Get the window title.
</ResponseField>

## Methods

### activate()

```typescript
activate(refId: number): void
```

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

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

### clearRefs()

```typescript
clearRefs(): void
```

Clear all stored element refs.

### expandCollapse()

```typescript
expandCollapse(refId: number): void
```

Expand or collapse a dropdown or tree item.

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

### find()

```typescript
find(order: TraversalOrder, role?: null | AriaRole, name?: null | string, visibleOnly?: null | boolean, maxResults?: null | number, collapseStructural?: null | boolean): AccessibilityNodeJs[]
```

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

<ResponseField name={"order"} type={"TraversalOrder"} required />

<ResponseField name={"role"} type={"null | AriaRole"} />

<ResponseField name={"name"} type={"null | string"} />

<ResponseField name={"visibleOnly"} type={"null | boolean"} />

<ResponseField name={"maxResults"} type={"null | number"} />

<ResponseField name={"collapseStructural"} type={"null | boolean"} />

#### Returns

`AccessibilityNodeJs[]`

### focusElement()

```typescript
focusElement(refId: number): void
```

Focus an element (brings window to foreground).

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

### fromForeground()

```typescript
fromForeground(): AccessibilityTree
```

Create an accessibility tree bound to the current foreground window.

#### Returns

`AccessibilityTree`

### fromHwnd()

```typescript
fromHwnd(hwnd: number): AccessibilityTree
```

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

#### Parameters

<ResponseField name={"hwnd"} type={"number"} required />

#### Returns

`AccessibilityTree`

### fromPid()

```typescript
fromPid(pid: number): AccessibilityTree
```

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

#### Parameters

<ResponseField name={"pid"} type={"number"} required />

#### Returns

`AccessibilityTree`

### getBounds()

```typescript
getBounds(refId: number): BoundingBox
```

Get the live bounding box of an element.

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

#### Returns

`BoundingBox`

### getSupportedActions()

```typescript
getSupportedActions(refId: number): string[]
```

Get the list of supported actions for an element.

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

#### Returns

`string[]`

### scrollIntoView()

```typescript
scrollIntoView(refId: number): void
```

Scroll an element into view.

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

### select()

```typescript
select(refId: number): void
```

Select a tab, radio button, or list item.

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

### setValue()

```typescript
setValue(refId: number, value: string): void
```

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

#### Parameters

<ResponseField name={"refId"} type={"number"} required />

<ResponseField name={"value"} type={"string"} required />

### snapshot()

```typescript
snapshot(visibleOnly?: null | boolean): AccessibilityNodeJs
```

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

<ResponseField name={"visibleOnly"} type={"null | boolean"} />

#### Returns

`AccessibilityNodeJs`

### toggle()

```typescript
toggle(refId: number): void
```

Toggle a checkbox or switch.

#### Parameters

<ResponseField name={"refId"} type={"number"} required />
