wait_for
Wait until an element or text reaches a requested state on dynamic pages, with timeout control. Synchronize automation steps by pausing until a condition is met.
Instructions
Wait until an element or text reaches a requested state.
When text is provided, a state of 'present' or 'visible' both wait
for the text to appear within the selector, and a state of 'not_visible'
or 'absent' both wait for the text to be absent from the selector.
Use this tool when the page is dynamic and an automation step must wait for a condition before continuing.
Unlike check_condition, this tool intentionally waits. Unlike assert_condition, its purpose is synchronization rather than validating a test expectation.
Args:
state:
- "present": Wait until the matching element exists.
- "visible": Wait until the matching element is visible.
- "not_visible": Wait until the matching element is not visible.
- "absent": Wait until the matching element no longer exists.
(This is handled differently when text is provided.)
selector: CSS selector or SeleniumBase selector for the element.
Required unless text is supplied.
text: If supplied and is not None, a state of 'present' or 'visible'
both wait for the text to appear within the selector, and a state
of 'not_visible' or 'absent' both wait for the text to be absent
from the selector (or within "body" when selector is omitted).
timeout: Maximum seconds to wait for the requested state to be true.
(Defaults to 7 seconds.)
Returns: A confirmation when the requested condition is reached.
Tool selection: - Check current state immediately -> use check_condition. - Wait for a state/content transition -> use wait_for. - Verify an expected value/condition -> use assert_condition.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | ||
| state | No | visible | |
| timeout | No | ||
| selector | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |