Scroll and Swipe
To do a simple vertical scroll you can simply say:
To have control over the swipe gesture, you have the following choices:
You can specify start and end coordinates in percentages to make the swipe gesture consistent across different screen dimensions:
start: 90%, 50% # From (90% of width, 50% of height)
end: 10%, 50% # To (10% of width, 50% of height)
Swiping in RIGHT, LEFT, UP, or DOWN directions:
- 1.LEFT: From the right to the left of the screen.
- 2.RIGHT: From the left to the right of the screen.
- 3.UP: From the middle of the device to the top of the device.
- 4.DOWN: From the top of the device to the bottom of the device.
- swipe: # This command swipes in the left direction from the middle of the device.
Relative start and end coordinates for directional swipe are configured as follows:
A common use case for this is to swipe the onboarding pages.
You can also specify elements as a starting point for swipe commands. It will swipe from the middle of the element in the direction you specify. Example:
id: "feeditem_identifier" # From (x, y) center of element
direction: UP # To (50% of width, 10% of height)
You can also specify start and end points for the swipe to have more control:
- swipe: # This command swipes from point (x:100, y:200) to point (x: 300, y:400). Units are in pixels
start: 100, 200
end: 300, 400
To control swiping speed you can use duration in the swipe command. The more the duration slower the swipe. By default, the swipe command uses 400 milliseconds. To configure speed you can use:
duration: 2000 # Values are in ms.
To scroll towards a direction until an element becomes visible in the view hierarchy, use the following command:
id: "viewId" # (optional) Finds view with id that matches regexp
text: "MyElementText" # (optional) Finds view with text that matches regexp
direction: DOWN # DOWN|UP|LEFT|RIGHT (optional, default: DOWN)
timeout: 50000 # (optional, default: 20000ms)
The scroll will move towards the direction specified
DOWN|UP|LEFT|RIGHT. For example, if
DOWNis specified then it will start scrolling towards the bottom of the screen.
If we want to scroll towards the bottom until a view with id