How-to
Scroll into view (scrollIntoViewIfNeeded)
Scroll into view (scrollIntoViewIfNeeded)
Scrolls the page until the Target is in view, when it is not already visible.
Step model
action_name | scrollIntoViewIfNeeded |
| Group | Pointer |
| Target | Required |
| Value | Unused |
| expected_value | Unused |
| TEST_ACCOUNT | Forbidden |
| Do not confuse with | hover, focus |
Target/Value facts match the source-of-truth catalog and Autotest step.
Prerequisites
- The Target locator is stable and the element is in the document.
Steps
- Add a
scrollIntoViewIfNeededstep. - Set Target.
- Leave Value empty.
- Save.
The step is stored on the autotest. Next - neighbouring steps or autotest run creation.
Examples
Heading at the bottom
Fields in the UI:
| Field | Value |
|---|---|
action_name | scrollIntoViewIfNeeded |
| Target | kind ROLE, value heading, name Footer |
Step JSON fragment (copy-paste):
json
{
"action_name": "scrollIntoViewIfNeeded",
"target": {
"kind": "ROLE",
"value": "heading",
"name": "Footer"
}
}Common mistakes
- The step does not replace a visibility assert. Add
toBeVisibleafterwards when you need the check.
Screenshots
Screenshots of the step form for scrollIntoViewIfNeeded will be added here in a later pass.
Did this page help?