scrollUntilVisible
This is similar to the simple scroll command but will keep scrolling until an element appears in the view hierarchy. Identify the element using a selector.
Basic Usage
Options
Speed
An optional number between 0
and 100
. A higher number means faster scrolling. Defaults to 40
.
Timeout
An optional value in milliseconds. If the target element is not found within the timeout then the command will error. The default value is 20000ms
(20 seconds).
Direction
An optional value (DOWN
, UP
, LEFT
or RIGHT
) that sets the direction of the scroll. For example, specifying UP
will scroll towards the top of the screen.
Visibility Percentage
An optional value between 0
and 100
; default 100
. This value determines how much of the element must be visible in the viewport before passing this step.
Centre Element
A boolean argument (True
/False
); default False
. The test runner will attempt to centre the target element in the centre of the viewport. Useful for visual inspection of test output via screenshots or video.
Examples
In this example, the test will scroll down very slowly until half the footer of the page appears. If it does not appear within 60 seconds then the step times out.
Related Commands
Last updated