swipe on android device using appium

Swipe on mobile handsets can be of fromSwipeScreen_Appium

  • Left to right or vice versa
  • Top to bottom or vice versa

As per the documentation provided on appium github on swipe() method, it accepts 5 parameters as start location (x and y axis location) to end location (x and y axis location) and the duration of swipe action.

swipe(int startX, int startY, int endX, int endY, int duration)

E.g – If want to move from left to right, change the startx and starty values, but keep constant for startY and endY values.

let’s see one of the code implementation –

We will be using Contacts application, where we will be swiping from right to left to move Favorites to All Contacts.

NOTE: Always better to get the width and height of the panel on which we want to swipe rather than hard coding the x and y axis values, as it gets changes from one device to another.

Explanation of the above code – refer below screenshot

Starting position – we have taken somewhere half of the way of the panel on which we need to swipe.


Shortlink – bit.ly/qav-apmswipe

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

5 Responses

  1. pratheep says:

    not working

  2. sunilpatro1985 says:

    what error u r getting, can I see ur code block and application u r working?

  3. Raghavendra says:

    Hi Sunil,

    I have a watermark in my application and i want to scroll till that watermark, but when i run the code it says unable to find the element can you please hlep me in this regard


  4. sunilpatro1985 says:

    Hi Raghvendra,

    Follow bit.ly/qav-apmScroll and retry, or share your app details so I can take a look.

  5. Raghavendra says:


    This code scrolls till the specified time in swipe method, please let me know how to swipe to specific element in the screen (Ex: if there is a element called password in the screen, i want to swipe till password)

Leave a Reply

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

%d bloggers like this: