Not able to perform scroll in android application

Hi Guys,
Since Touch actions class is deprecated, and most other solutions using MobileBy.AndroidUIAutomator seems to be deprecated as well… Can you please provide me a solution on how to scroll in android application using java.

Code which I used where MobileBy.AndroidUIAutomator shows as depricated:

String text1 = “Register User (verify)”;
WebElement registerbtn = (WebElement) driver.findElement(
MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().”
+ “textContains(”"+text1+""))"));
registerbtn.click();

Touch actions which is also deprecated:

TouchActions action = new TouchActions(driver);
action.scroll(element, X, Y);
action.perform();

I have also tried using keyboards actions down it works fine, But it would be better If I get solutions to perform scroll actions…

Thanks in advance.

Hi @Manju_Natha
I’ve you same problem and I don’t understand this heavy refactoring by Appium, which creates a lot of difficulties. All threads talk about old, invalid solutions as a TouchActions or MobileBy :rage:

I’ve been implementing a method that execute a js script but I’m not really satisfied.

private static void scrollDown() {
    String gesture = "mobile: scrollGesture";
    Map<String, Object> param = new MapMaker().makeMap();
    param.put("left", 200);
    param.put("top", 200);
    param.put("width", 200);
    param.put("height", 700);
    param.put("direction", "down");
    param.put("percent", 1);

    ((JavascriptExecutor) driver).executeScript(gesture, param);
}  

Do you have find other solution?