This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 3
Nov 2018

scrolling is working fine in normal pages in android application.But if i click on any element it will open as a new page over existing page,there scrolling is not working in appium automation using touchaction.here is my code to scrolldown

public void scrollDown(AppiumDriver driver){
try {
int height = driver.manage().window().getSize().getHeight();
TouchAction touchAction = new TouchAction(driver);
touchAction.longPress(5, height * 2 / 3).moveTo(5, height / 3).release().perform();
}
catch(Exception e) {
e.getMessage();
}
}

  • created

    Nov '18
  • last reply

    Dec '18
  • 2

    replies

  • 128

    views

  • 2

    users

Here is my code using AndroidDriver:

public void scrollUpManually() {
    Dimension size = driver.manage().window().getSize();
    int starty = (int) (size.height * 0.40);
    int endy = (int) (size.height * 0.90);
    int startx = size.width / 2;

    driver.swipe(startx, starty, startx, endy, 1000);
}

public void scrollDownManually() {
    Dimension size = driver.manage().window().getSize();
    int starty = (int) (size.height * 0.80);
    int endy = (int) (size.height * 0.20);
    int startx = size.width / 2;

    driver.swipe(startx, starty, startx, endy, 1000);
}

Driver.swipe is deprecated.its no longer available iam using java-client 6.0.0
so touch action is recomented