wait_for_element
Wait for a page element to reach a specified state (visible, hidden, attached, or detached) after actions like async loading or modal opening, preventing race conditions in web automation.
Instructions
Wait for an element to reach a given state on the page.
Useful after an action that triggers async loading, modal opening, or element removal. Returns ok once the condition is met.
Args: selector: CSS selector for the element to watch. timeout_ms: Maximum time to wait in milliseconds (default 10 000). state: One of: 'visible' — element exists and is visible (default) 'hidden' — element exists but is hidden, or does not exist 'attached' — element is in the DOM (may be hidden) 'detached' — element has been removed from the DOM
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | visible | |
| selector | Yes | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |