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