wait_for_condition
Block automation until a page element is present, visible, hidden, or gone, or for a set number of seconds, so dynamic pages finish loading before the next step.
Instructions
Wait for a page condition or for a specified duration.
Use this for synchronization when a dynamic page may need time to reach a condition before the next automation step. The tool blocks until the condition is met or the timeout expires. It does not intentionally scroll, click, or otherwise modify the page while waiting.
Use check_if_condition to inspect the current state without waiting. Use assert_condition to verify an expected condition rather than synchronize with a changing page.
When the condition is not reached before timeout, the underlying
SeleniumBase wait failure is handled by the tool's error handler rather
than returning a success confirmation.
If state="seconds_passed", selector and text are ignored and the
tool blocks for the full timeout seconds.
If text is supplied, present/visible wait for the text to appear,
while absent/not_visible wait for the text to disappear.
If no selector is supplied, text is searched within the page body.
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.
- "seconds_passed": Wait for the full timeout duration.
selector: CSS or SeleniumBase selector for the element.
Required unless `text` is supplied or `state="seconds_passed"`.
text: Optional text to wait for or wait to disappear.
With text, `present` and `visible` are equivalent,
as are `absent` and `not_visible`.
timeout: Maximum seconds to wait for the condition;
for `seconds_passed`, the exact duration to wait. Must be >= 0.Returns: A success message when the requested condition is reached. If the condition times out or the underlying wait fails, the tool returns the error produced by its error handler.
Tool selection: - Inspect current state immediately -> check_if_condition. - Wait for a state change -> wait_for_condition. - Verify an expectation -> 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 |