0
votes

I am automating a hybrid app and I want scroll vertically from top to bottom in a page which is in web view. I am using java client-5.0.4 and appium version is v1.7.2

enter image description here

1
Have you tried anything? - Aniket Sahrawat
Yes I tried TouchAction and JavascriptExecutor but no luck - Madhuri
You need to show the attempts right? - Aniket Sahrawat
Actually I tried two methods 1. TouchAction myAction = new TouchAction(driver); myAction.press(1, 0).moveTo(1, 0).release().perform(); 2. JavascriptExecutor js = (JavascriptExecutor) driver; HashMap scrollObject = new HashMap(); scrollObject.put("direction", "down"); js.executeScript("mobile: scroll", scrollObject); and I am using java-client 5.0.4, appium server 1.7.2, selenium 3.9.1 and commons-lang3-3.7.jar . - Madhuri
The problem is code is not throwing any error but scrolling is not happening in the page. - Madhuri

1 Answers

0
votes

You can swipe in an app with appium using the press method. E.g. :

TouchAction().press(el0).moveTo(el1).release()

It also works with coordinates if you wish to use that instead of webelements.

More information on touch actions can be found here : https://appium.io/docs/en/writing-running-appium/touch-actions/