Hi!
(This was somewhat of java 6 language specific thing)
After multiple tries and pages, here is what I found as a working solution:
public void scrollDown() {
//The viewing size of the device
Dimension size = driver.manage().window().getSize();
//x position set to mid-screen horizontally
int width = size.width / 2;
//Starting y location set to 80% of the height (near bottom)
int startPoint = (int) (size.getHeight() * 0.80);
//Ending y location set to 20% of the height (near top)
int endPoint = (int) (size.getHeight() * 0.20);
new TouchAction(driver).press(PointOption.point(width, startPoint)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(2000))).moveTo(PointOption.point(width, endPoint)).release().perform();
}
My driver is a public property on top of the class:
public AppiumDriver<MobileElement> driver;
Instantiated in @BeforeMethod
driver = new AndroidDriver(new URL(“http://0.0.0.0:4723/wd/hub”),caps);