ApplesauceOS
Read Markdown ↗Download .md

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

ParameterTypeMeaning
bundleIdJSON stringOptional foreground app identifier.
selectorJSON objectRequired UIHelper selector.
conditionJSON stringexists (default) or absent.
timeoutMsJSON number0..10000 milliseconds; default 5000.
intervalMsJSON number100..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.