.longPress(options)
Performs long press gesture on the element.
Usage
element(matcher).longPress(options)
Parameters
options(Object?):options.x(Number?): x offset from left of element. Defaults to center point.options.y(Number?): y offset from top of element. Defaults to center point.options.duration(Number?): Time in milliseconds to perform the press gesture. Defaults to 750.
Returns
Element: A new element to avoid mutation and allow function chaining.
Support
| Platform | Supported |
|---|---|
| iOS | Yes |
| Android | Yes |
| Web | No |
Examples
Perform long press gesture at element center point:
const { element, by } = require("appdriver");
(async () => {
await element(by.label("button"))
.longPress();
})();
Perform long press gesture at (100, 25), relative to the element location:
const { element, by } = require("appdriver");
(async () => {
await element(by.label("button"))
.longPress({ x: 100, y: 25 });
})();