.swipe(options)
Performs a swipe gesture on the element.
Usage
element(matcher).swipe(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).options.direction(Number): Direction in degrees (0-359) of swipe.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 left 100 pixels. This will swipe left from the coordinate (100, 24) to (0, 24), relative to the element:
const { element, by } = require("appdriver");
(async () => {
await element(by.label("list-item"))
.swipe({ x: 100, y: 24, distance: 100, direction: 270 });
})();