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
- scrollUntilVisible:
element:
text: "some text" # Any selector to identify the element
speed: 80 # Optional number between 0-100. A higher number means faster scrolling.
timeout: 10000 # Optional value in milliseconds after which the command fails if it's not found the element. Defaults to 20000ms.
direction: DOWN # DOWN|UP|LEFT|RIGHT (optional, default: DOWN)
visibilityPercentage: 100 # 0-100 (optional, default 100) Percentage of element visible in viewport
centreElement: # Will attempt to centre the element in the viewportOptions
Speed
An optional number between 0 and 100. A higher number means faster scrolling. Defaults to 40.
- scrollUntilVisible:
element:
text: "submit"
speed: 80Timeout
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).
- scrollUntilVisible:
element:
text: "submit"
timeout: 30000Direction
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.
- scrollUntilVisible:
element:
text: "submit"
direction: UPVisibility 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.
- scrollUntilVisible:
element:
text: "submit"
visibilityPercentage: 20Centre 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.
- scrollUntilVisible:
element:
text: "submit"
centreElement: TrueExamples
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.
- scrollUntilVisible:
element:
id: "page-footer"
visibilityPercentage: 50
timeout: 60000Related Commands
Last updated
Was this helpful?