To scroll towards a direction until an element becomes visible in the view hierarchy, use the following command:
- scrollUntilVisible:
element:
id: "viewId" # or any other selector
direction: DOWN # DOWN|UP|LEFT|RIGHT (optional, default: DOWN)
timeout: 50000 # (optional, default: 20000ms)
speed: 40 # 0-100 (optional, default: 40) Scroll speed. Higher values scroll faster.
visibilityPercentage: 100 # 0-100 (optional, default 100) Percentage of element visible in viewport
Please refer to the Selectors page for a full list of supported selectors.
The scroll will move towards the direction specified DOWN|UP|LEFT|RIGHT
. For example, if DOWN
is specified then it will start scrolling towards the bottom of the screen.
By default an element will be considered visible if it is fully displayed in the viewport. You can adjust that threshold by modifying visibilityPercentage
.
If you want to scroll until the text "My text" is visible you can run the following command:
- scrollUntilVisible:
element: "My text" # or any other selector
direction: DOWN
If we want to scroll towards the bottom until a view with id com.example.resource.some_view_id
becomes visible, you can use the id
selector like this:
- scrollUntilVisible:
element:
id: ".*some_view_id" # or any other selector
direction: DOWN