how to scroll in appium using java

Solutions on MaxInterview for how to scroll in appium using java by the best coders in the world

showing results for - "how to scroll in appium using java"
Ewen
13 Jan 2021
1public void scrollDown()  {
2
3    //The viewing size of the device
4    Dimension size = driver.manage().window().getSize();
5
6    //x position set to mid-screen horizontally
7    int width = size.width / 2;
8
9    //Starting y location set to 80% of the height (near bottom)
10    int startPoint = (int) (size.getHeight() * 0.80);
11
12    //Ending y location set to 20% of the height (near top)
13    int endPoint = (int) (size.getHeight() * 0.20);
14
15    new TouchAction(driver).press(PointOption.point(width, startPoint)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(2000))).moveTo(PointOption.point(width, endPoint)).release().perform();
16
17}
18