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

Vertical Swipe by percentages

Category: Appium
public void verticalSwipeByPercentages(double startPercentage, double endPercentage, double anchorPercentage) {
        Dimension size = driver.manage().window().getSize();
        int anchor = (int) (size.width * anchorPercentage);
        int startPoint = (int) (size.height * startPercentage);
        int endPoint = (int) (size.height * endPercentage);

         TouchAction touch = new TouchAction(driver);
             touch.press(point(anchor, startPoint))
            .waitAction(waitOptions(ofMillis(1000)))
            .moveTo(point(anchor, endPoint))
            .release().perform();
    }

Leave a Reply

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