How to use scroll or swipe?

Hi all, I tried below code but it is not working
driver = new AndroidDriver (new URL(“”), capabilities);
TouchAction touchAction = new TouchAction(driver);
new TouchAction(driver).press(250,1500).moveTo(250,100).release().perform();

Hi Anand, may I know what Appium and Java-client version you are using?

Hi Uma,
I am using below versions
Appium Java Client : 4.1.2
Selenium Java : 3.5.2
Java jdk:

If you can share some reference code for gesture command it will be helpful.

I tried below code it is working.
size = driver.manage().window().getSize();
//Find swipe x points from screen’s with and height.
int x1 = (int) (size.width * 0.20);
//Find x2 point which is at left side of screen.
int x2 = (int) (size.width * 0.80);
//Create object of TouchAction class.
TouchAction action = new TouchAction((MobileDriver)driver);
//Find element to swipe from right to left.
//Create swipe action chain and perform horizontal(right to left) swipe.
//Here swipe to point x1 Is at left side of screen. So It will swipe element from right to left.

1 Like