# UIHelper.findElement

Find the first matching element.

```js
ui.findElement(selector, options?)
```

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `selector` | object \| string | Attribute filters; a string means {name: string}. See the UIHelper guide for selectors. |
| `options` | object | Optional {timeout:0, interval:100}. Ordinary queries do not wait by default. |

## Returns

Element, or null when no match is found.

## Example

```js
const ui = UIHelper.forApp("com.example.app");
const field = ui.findElement({id: "search", visible: true});
if (field) console.log(field.getText());
```

## Notes

Replace example identifiers with selectors verified in your app. Pinning an app does not open it. This does not assert uniqueness. Global shortcuts use the unpinned foreground-app client.

## Also available as

`findElement`.

[All JavaScript APIs](https://mcp.applesauceos.com/doc/api.md) · [Automation playbook](https://mcp.applesauceos.com/doc/ai.md)
