How to swipe horizontally in Android native app(Left to Right and Right to Left) ? – pCloudy – Question and Answers
Home >> Appium Tricks and Tricks >> How to swipe horizontally in Android native ...

How to swipe horizontally in Android native app(Left to Right and Right to Left) ?


Code Snippet:

Dimension size = driver.manage().window().getSize()
//Find swipe start and end point from screen's with and height.
//Find startx point which is at right side of screen.
int startx = (int) (size.width * 0.90);

//Find endx point which is at left side of screen.
int endx = (int) (size.width * 0.10);

//Find vertical point where you wants to swipe. It is in middle of screen height.
int starty = size.height / 2;

//Swipe from Right to Left.
driver.swipe(startx, starty, endx, starty, 2000);

//Swipe from Left to Right.
driver.swipe(endx, starty, startx, starty, 2000);
Note : It will work only on below 6.0.* java client version

Leave a Reply

Your email address will not be published. Required fields are marked *