wait
Wait for a condition to be met.
Bridge
Bridge required for --selector and --eval. The --title mode works without a bridge.
Usage
Options
| Option | Description | Default |
|---|---|---|
-s, --selector <css> |
Wait for CSS selector to match an element | — |
-e, --eval <js> |
Wait for JS expression to be truthy | — |
-t, --title <regex> |
Wait for window with title (no bridge needed) | — |
--timeout <ms> |
Maximum wait time in milliseconds | 10000 |
--interval <ms> |
Polling interval in milliseconds | 500 |
--port <number> |
Bridge port (auto-discover if omitted) | — |
--token <string> |
Bridge token (auto-discover if omitted) | — |
One of --selector, --eval, or --title is required.
Examples
Wait for a DOM element
Wait for a window to appear
Outputs the window ID when found.
Wait for a JS condition
Custom polling interval
Behavior
--selector: pollsdocument.querySelector()until a matching element exists--eval: polls the JS expression until it returns a truthy value--title: polls the platform adapter'sfindWindow()until a matching window appears- Throws an error if the condition is not met within
--timeout - Exits with code 0 on success, non-zero on timeout