How-to
Wait for selector (waitForSelector)
Wait for selector (waitForSelector)
Waits until Target appears in the DOM/page. Prefer this over a fixed waitForTimeout pause.
Step model
action_name | waitForSelector |
| Group | Wait |
| Target | Required |
| Value | Unused |
| expected_value | Unused |
| TEST_ACCOUNT | Forbidden |
| Do not confuse with | toBeVisible, waitForTimeout |
Target/Value facts match the source-of-truth catalog and Autotest step.
Prerequisites
- You know a stable locator for the expected element.
Steps
- Add a
waitForSelectorstep. - Set Target.
- Optionally set
timeout_ms. - Save.
The step is stored on the autotest. Next - neighbouring steps or autotest run creation.
Examples
Wait for the results table
Fields in the UI:
| Field | Value |
|---|---|
action_name | waitForSelector |
| Target | kind TESTID, value results-table |
| timeout_ms | 15000 |
Step JSON fragment (copy-paste):
json
{
"action_name": "waitForSelector",
"target": {
"kind": "TESTID",
"value": "results-table"
},
"timeout_ms": 15000
}Common mistakes
- Do not use a long waitForTimeout «just in case» instead of waiting for a selector.
- To assert visibility after appearance, prefer
toBeVisible.
Screenshots
Screenshots of the step form for waitForSelector will be added here in a later pass.
Did this page help?