Vertical scrolling in an android App using Applium, Appium clicks on GUI element, instead of scrolling

I am doing mobile automation where I need to perform the vertical scroll in a application.
The GUI where I need to perform the scroll contains a list of data, and each data is a link.

I am using appium-python client to communicate with the Applium tool from my python code.
In order to do scroll I did the following steps:

  1. Create a driver object
  2. Get two coordinates from screen, from_point and to_point
  3. Then use the swipe api of the driver to perform the scroll,
    self.driver.swipe(from_point_x, from_point_y, to_point_x, to_point_y, 2000)
    Observe : Some time it able to scroll vertically but sometime it clicks on element on the GUI which causes application to move on different screen.

Could anyone advice how to resolve this issue.

Can you try to use scrollTo() or scrollToExact() APIs ?

Thanks RamS,
but in the appium python module I didn’t find any function with name “scrollToExact” or “scrollTo”

Two ideas as to why a swipe might be calculated by the OS as a click:

  • Too short of a swipe duration. However, it appears you’re supplying 2000 for the swipe duration. But try something longer.
  • Coordinates identical or otherwise not far enough apart to be calculated by the OS as a click instead of swipe between two points.

Hi,

I am also facing a similar issue with vertical scrolling.
I have used the swipe() function for vertical scrolling, but it does not work consistently.
In order to count the number of elements present in a list I need to scroll the list one element per scroll till it reaches the end of list, but the same swipe function sometimes scrolls the list by say 100 unit and sometimes by 80 units.

I faced same issue on Android
it solved by increasing swipe time.
my code looks like

picNumber.get(0).swipe(SwipeElementDirection.UP,500);

It seem it was due to the short distance, when there is more data then the swap distance was far, but it come for short number of data my swap co-ordinate get closer and instead of swapping it clicks on that element.
Thank you Christopher. :slight_smile: :slight_smile:

I’m also facing the same issue, actually i wanna scroll a list view whereas its clicking the spinner on the screen top.
scroll() or scrolltoexact() methods are not wrking. Can anyone help on this,

Appium version: 1.4.0.0
using JAVA

1 Like