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
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>"
},
"name": "wait_for_element"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| state | No | visible | |
| selector | Yes | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |