Wait for a condition
qa_wait_forPause until the page meets one named condition (element, text, count, announcement, or URL), then return. Use after slow saves, confirmations, or sign-in steps instead of polling snapshots.
Instructions
Wait until the page satisfies ONE named condition, then return — instead of polling qa_snapshot, which renumbers every ref each time it is called. Conditions: appears / disappears / enabled (each takes an accessible name OR a CSS selector) · text / textGone (anywhere on the page) · countOf a selector with atLeast or exactly · announced (what the page said through a live region — pass a string to wait for one containing it, or true for any) · urlContains. Use it after anything whose answer arrives later than a click settles: an order confirmation, a slow save, a list that repopulates, a button that ungreys when validation finishes. A condition already true when you call returns immediately. ON TIMEOUT IT SAYS WHAT IT SAW — how many matched, how many were visible, the nearest names on the page, and anything announced — so a wait that failed on a typo tells you so instead of just running out. A SIGN-IN IS WHAT THIS IS FOR, MORE THAN ANYTHING ELSE. When the site hands over to a password, a code from a phone or a hardware key, that step is the person's — do not drive it and do not call it a failure. Tell them to sign in, then qa_wait_for { urlContains: "<the site you came from>", timeoutMs: 180000 }: it is answered by the extension, so it survives the navigation, and if the tab never moves at all it says THAT instead of just running out. Up to 300000 ms is real: the wait runs in slices and keeps the call alive. If it still comes back with stillWaiting, call it again with the same arguments; never ask the person to write that they are done. Read-only: waiting is not acting, so this needs no consent — the same footing as qa_wait_ready. There is no "until quiet" (that is what every action already does) and no "until the network is idle" (the interceptor sees only the page's own fetch/XHR in the top frame, so the number would not mean what its name says).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "qa_wait_for"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Wait until this text is anywhere on the page | |
| tabId | No | Target tab (from qa_tabs); omit for the active tab | |
| appears | No | Wait until this appears — accessible name or CSS selector | |
| atLeast | No | With countOf: wait until at least this many match (default 1) | |
| countOf | No | CSS selector to count — pair with atLeast or exactly | |
| enabled | No | Wait until this control stops being disabled | |
| exactly | No | With countOf: wait until exactly this many match | |
| textGone | No | Wait until this text is no longer on the page | |
| announced | No | Wait until a live region speaks — a string waits for one containing it, true for any | |
| timeoutMs | No | Give up after this long (default 15000, max 60000 — or up to 300000 with urlContains, which is how you wait for a person to sign in) | |
| disappears | No | Wait until this is gone — accessible name or CSS selector | |
| urlContains | No | Wait until the tab address contains this. Answered by the extension itself, so it survives the navigation it is waiting for. |