wait command polls for an element matching specified filters, blocking until the element appears or a timeout is reached.
Overview
Arguments
string
required
Application name or bundle identifier
Options
string
Filter by accessibility role
string
Filter by title (substring match)
string
Filter by label (substring match)
string
Filter by identifier (substring match)
number
default:"10.0"
Maximum time to wait in seconds
number
default:"0.5"
Polling interval in seconds (how often to check)
string
default:"text"
Output format:
text or jsonExamples
Wait for button to appear
Wait for alert dialog
Wait with custom interval
JSON output
Common use cases
Wait for page load
Wait for dialog to appear
Wait for async operation
Wait for element to be ready
Timeout behavior
When the timeout is reached without finding the element:Error handling in scripts
Basic error handling
Retry logic
Fallback actions
Performance considerations
Polling interval
The--interval option controls how often the command checks for the element:
- Fast polling
- Normal polling
- Slow polling
- Quick UI updates
- Animations
- Immediate feedback
Timeout tuning
Choose appropriate timeouts based on expected operation duration:Advanced patterns
Wait for element to disappear
Wait for multiple conditions
Wait with progress indication
Tips
The
wait command returns immediately when the element is found - you don’t always wait the full timeout.Related commands
find- Search for elements without waitingsnapshot- Create element reference mapis enabled- Check if element is interactiveget text- Read element content after waiting