# Element.waitForAny

Wait for any of several possible screen states. Scoped to descendants.

```js
element.waitForAny(selectors, optionsOrTimeout?)
```

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `selectors` | array | 1..32 selector objects or strings. |
| `optionsOrTimeout` | object \| number | Optional milliseconds, or {timeout:5000, interval:100, throwOnTimeout:true}. Interval is at least 10 ms. |

## Returns

First matching element in tree order, not selector priority. Timeout throws, or returns null when disabled.

## Example

```js
const panel = UIHelper.waitForElement({id: "panel"}, 5000);
const next = panel.waitForAny([{id: "results", visible: true}, {id: "networkError", visible: true}], 8000);
console.log(next.snapshot.identifier);
```

## Notes

The parent must still be valid. See the matching UIHelper method for options. Placeholder panel/child identifiers require inspection.

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