Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

Horizontal Swipe by percentages

Category: Appium
public void horizontalSwipeByPercentage (double startPercentage, double endPercentage, double anchorPercentage) {
    Dimension size = driver.manage().window().getSize();
    int anchor = (int) (size.height * anchorPercentage);
    int startPoint = (int) (size.width * startPercentage);
    int endPoint = (int) (size.width * endPercentage);
    TouchAction touch = new TouchAction(driver);
        touch.press(point(startPoint, anchor))
        .waitAction(waitOptions(ofMillis(1000)))
        .moveTo(point(endPoint, anchor))
        .release().perform();
}

Leave a Reply

Your email address will not be published. Required fields are marked *