POST /ui/wait
Wait for a selector to appear or disappear.
This is a device HTTP route. Set DEVICE_URL to your reachable device URL; connection and examples explain how. Do not append this path to the public MCP URL.
Parameters
| Parameter | Type | Meaning |
|---|---|---|
bundleId | JSON string | Optional foreground app identifier. |
selector | JSON object | Required UIHelper selector. |
condition | JSON string | exists (default) or absent. |
timeoutMs | JSON number | 0..10000 milliseconds; default 5000. |
intervalMs | JSON number | 100..2000 milliseconds; default 200. |
Response
On success: {matched:true,condition,count,elapsedMs}. Timeout: HTTP 408 with error,message,condition,lastQuery.
Example
sh
curl --fail-with-body "$DEVICE_URL/ui/wait" \
-H 'Content-Type: application/json' \
-d '{"selector":{"id":"loading","visible":true},"condition":"absent","timeoutMs":5000}'Notes
Unlike JavaScript waitForElement, this returns condition evidence, not an Element object or observation reference. It checks immediately; an individual helper request can outlast the polling deadline.
Check the HTTP status and any JSON error. HTTP workflows and error handling explain shared limits. All endpoints.