Unable to scroll/swipe using latest java client

Hi,

I’m trying to swipe/scroll on the mobile screen using different ways available or suggested as in below link: https://stackoverflow.com/questions/55307113/how-to-use-swipe-down-scroll-down-in-appium-with-java-client-7-0-0
But no luck. Please suggest the methods to using to scroll on the screen.
Appium version: 1.9.1
Appium Client version: java-client-6.1.0

Thanks.

Hi SSB,
You can use the following method for swipe/scroll :

TouchAction action = new TouchAction(driver);
action.press(PointOption.point(fromX,fromY))
.waitAction(new WaitOptions().withDuration(Duration.ofMillis(600)))
.moveTo(PointOption.point(toX, toY))
.release()
.perform();

Just you need to calculate the co-ordinated in order to swipe /scroll left,right,up and down.

1 Like

Hi ,
I have tried this earlier. It throws the below error:

Apr 25, 2019 11:52:23 AM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0

INFO: Detected dialect: W3C

Apr 25, 2019 11:52:27 AM org.openqa.selenium.remote.ErrorCodes toStatus

INFO: HTTP Status: ‘404’ -> incorrect JSON status mapping for ‘unknown method’ (405 expected)

Exception in thread “main” org.openqa.selenium.UnsupportedCommandException: Method has not yet been implemented

Build info: version: ‘3.12.0’, revision: ‘7c6e0b3’, time: ‘2018-05-08T14:04:26.12Z’

System info: host: ‘Saisrees-MacBook-Pro-2.local’, ip: ‘fe80:0:0:0:40d:8464:b6db:c940%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.6’, java.version: ‘1.8.0_191’

Driver info: io.appium.java_client.android.AndroidDriver

Capabilities {browserName: Chrome, databaseEnabled: false, desired: {browserName: Chrome, deviceName: Galaxy J5, noReset: true, platformName: android, platformVersion: 6.0.1, udid: eb74c083}, deviceManufacturer: samsung, deviceModel: SM-J500FN, deviceName: eb74c083, deviceScreenSize: 720x1280, deviceUDID: eb74c083, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, noReset: true, platform: LINUX, platformName: Android, platformVersion: 6.0.1, takesScreenshot: true, udid: eb74c083, warnings: {}, webStorageEnabled: false}

Thanks for the quick reply.

Hi SSB,
Please upgrade your Appium client to latest version 7.0.0 and check

Hi Bhavin,

Tried after updating the Appium client. But no luck!

26

Hi SSB,

Appium logs?
Code to reproduce?

Check out this link if it can help you (https://stackoverflow.com/a/46587463) - [https://stackoverflow.com/a/46587463 ]

Hi Bhavin,

After downgrading Appium to 1.9.1 and client upgrading to 7.0.0 swipe worked for below code:

TouchAction action = new TouchAction(driver);
PointOption p1= new PointOption();
Dimension dimensions = driver.manage().window().getSize();
Double screenHeightStart = dimensions.getHeight() * 0.5;
int h1 = screenHeightStart.intValue();
Double screenHeightEnd = dimensions.getHeight() * 0.2;
int h2 = screenHeightEnd.intValue();
action.press(PointOption.point(0,h1))
.waitAction(new WaitOptions().withDuration(Duration.ofMillis(600)))
.moveTo(PointOption.point(0, h2))
.release()
.perform();

Can you suggest any links for handling or swiping inside the Number picker in Android?

Thanks for your support.