Swipe Actions
Swipe Vertical on screen:
public static void swipeVertical(double startPercentage, double finalPercentage, double anchorPercentage) throws InterruptedException {
Dimension size = driver.manage().window().getSize();
int anchor = (int) (size.width * anchorPercentage);
int startPoint = (int) (size.height * startPercentage);
int endPoint = (int) (size.height * finalPercentage);
new TouchAction(driver).press(anchor, startPoint).moveTo(0, endPoint - startPoint).release().perform();
}test.java
$ helper.swipeVertical(0.9, 0.1, 0.5);Swipe Horizontal on screen:
Swipe using TouchAction perform of screen:
Swipe using Elements of screen:
Last updated