I have ajava/serenity/appium project and currently my capabilites are set in a serenity properties file. Below I want to perform a scroll but I receive a null pointer exception error for my androidDriver. I am unsure on how to fix the null pointer exception.
public class ScrollingMethods extends PageObject {
AndroidDriver androidDriver;
public void scrollDown() {
int pressX = androidDriver.manage().window().getSize().width / 2;
int bottomY = androidDriver.manage().window().getSize().height * 4/5;
int topY = androidDriver.manage().window().getSize().height / 8;
scroll(pressX, bottomY, pressX, topY);
}
public void scroll(int fromX, int fromY, int toX, int toY) {
TouchAction touchAction = new TouchAction(androidDriver);
touchAction.longPress(fromX, fromY).moveTo(toX, toY).release().perform();
}
}