Swipe/Scroll best practice with Java-Client 5

@menypeled it is depending on your platform :slight_smile:

    protected void swipe_iOS(int startx, int starty, int endx, int endy, int duration) {
        swipe(startx, starty, -startx + endx, -starty + endy, duration);
    }

    protected void swipe(int startx, int starty, int endx, int endy, int duration) { // Android ONLY!
        System.out.println("    swipe(" + startx + ", " + starty + ", " + endx + ", " + endy + ")");
        new TouchAction((MobileDriver) driver).press(startx, starty).waitAction(Duration.ofMillis(duration)).moveTo(endx, endy).release().perform();
    }
4 Likes