wait_for
Wait until the element matching the CSS selector reaches a state (default 10s, max 30s). state: attached (exists, default), visible (a match is actually shown, so hidden leftover dialogs don't count), hidden (no match is shown: a modal closed, a spinner went away), detached (removed from the page). Returns found=false on timeout.
Example#
Call this MCP tool with the argument object below. Replace illustrative IDs, selectors, local paths, and project URLs with values observed in your session.
{
"selector": "main",
"state": "visible",
"timeout_ms": 10000
}Usage notes#
Use a selector observed on the page. An already-visible element does not prove that a new asynchronous operation completed.
Result#
Resolves when the target reaches attached, visible, hidden, or detached state, or reports a timeout.
Results arrive in MCP content blocks. Most structured results are JSON in text blocks; image tools can include image blocks. Handle errors and partial or truncated data. No formal output schema is declared for this tool.
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
selector | string | Yes | See usage and full schema below. |
timeout_ms | number | No | See usage and full schema below. |
state | "attached" / "visible" / "hidden" / "detached" | No | See usage and full schema below. |
frame | string | No | Act inside an iframe: selector of the <iframe> element (find_elements/read_page/get_page_text list them). Nested frames chain with " >> ", e.g. "#checkout >> iframe[name=card]". minLength: 1 |
tab | string | No | Tab name or id in your workspace; does not change the visible tab. minLength: 1 |
Full input schema#
The schema includes nested shapes and constraints. Additional semantic constraints can apply at runtime; read the description and usage notes.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"selector": {
"type": "string"
},
"timeout_ms": {
"type": "number"
},
"state": {
"type": "string",
"enum": [
"attached",
"visible",
"hidden",
"detached"
]
},
"frame": {
"description": "Act inside an iframe: selector of the <iframe> element (find_elements/read_page/get_page_text list them). Nested frames chain with \" >> \", e.g. \"#checkout >> iframe[name=card]\".",
"type": "string",
"minLength": 1
},
"tab": {
"description": "Tab name or id in your workspace; does not change the visible tab.",
"type": "string",
"minLength": 1
}
},
"required": [
"selector"
],
"additionalProperties": false
}Related documentation#
Reference conventions · Agent operating guide · Troubleshooting