.swipeDown(options)
Performs a swipe down gesture on the element.
Usage
element(matcher).swipeDown(options)
Parameters
options
(Object?
):options.x
(Number?
): X coordinate to begin the gesture from. Defaults to 0.options.y
(Number?
): Y coordinate to begin the gesture from. Defaults to 0.options.distance
(Number
): Distance of swipe in density independent pixels (DIP). Required ifpercentage
isn't provided.options.percentage
(Number?
): Percentage distance (0-1) of swipe relative to the height of the element. Required ifdistance
isn't provided.options.duration
(Number?
): Time in milliseconds to perform the swipe gesture.
Returns
Element
: A new element to avoid mutation and allow function chaining.
Support
Platform | Supported |
---|---|
iOS | Yes |
Android | Yes |
Web | No |
Examples
Swipe down 48 pixels. This will swipe down from the coordinate (100, 0) to (100, 48), relative to the element:
const { element, by } = require("appdriver");
(async () => {
await element(by.label("list-item"))
.swipeDown({ x: 100, distance: 48 });
})();
Swipe down 25% of the element height. Given the element has a height of 40, this will swipe down from the coordinate (0, 0) to (0, 10), relative to the element:
const { element, by } = require("appdriver");
(async () => {
await element(by.label("list-item"))
.swipeDown({ percentage: 0.25 });
})();