await-ui-element
Waits for a UI element to appear, become visible, disappear, or match text after taps/navigation, returning success or timeout cause so you can avoid manual screenshot polling.
Instructions
Block until a UI element reaches an expected state or the timeout elapses, so you don't have to poll screenshot/describe yourself. It polls the same tree as describe.
Use when the next step needs an element that appears or disappears asynchronously, e.g. after a tap or navigation, or before tapping something that loads late.
Returns { success: boolean, elapsed: number, note?, cause? }. If the condition does not hold by the timeout, it returns success=false, and that is not always a verdict on the condition: cause says which it was: unmet (the tree was read and the condition was false there), unreadable (no trustworthy read, so nothing was judged) or cancelled. note describes what was seen. Only unmet licenses rewriting the check.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"udid": "<udid>",
"condition": "<condition>",
"selector": "<selector>"
},
"name": "await-ui-element"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, or Chromium id). | |
| bundleId | No | iOS app bundle id, passed to the describe fallback (see `describe`). Ignored on every other platform, including physical iOS. | |
| selector | Yes | Element to match. Give at least one field; every given field must match. | |
| condition | Yes | What to wait for. `exists`: the selector matches an element anywhere in the tree. `visible`: it matches one with a non-zero on-screen frame. `hidden`: it matches nothing, or only a zero-area element (e.g. a spinner that went away). `text`: the first visible match in reading order (topmost, then leftmost; the first match overall if none is visible) contains expectedText, or equals it with textMatch `equals`. Only that match is checked, so if a loose selector hits several elements, narrow it to the one holding the text. | |
| textMatch | No | For condition `text`: how expectedText is compared. `contains` (default) is a case-insensitive substring; `equals` is a case-insensitive full-string match. | |
| timeoutMs | No | Max time to wait for the condition before giving up (default 5000). Maximum: 120000. Must be greater than 0. | |
| expectedText | No | Required for condition `text`: the string the checked match must contain or equal (see `textMatch`). | |
| pollIntervalMs | No | How often to re-check the tree (default 400). Range: 50 to 5000. |