How to slow down scroll speed using TouchAction()

I want to scroll through a recycler view in android. I am using TouchAction to scroll.

getToucAction().press(511, 1200).moveTo(0, -450).release().perform();

But the problem is, scrolling is too fast and i am not able to grab any specific element in the list.
Can any one suggest any work around.

There’s a similar example for swipe

TouchAction swipe = new TouchAction(driver).press(images.get(2), -10, center.y - location.y)
.waitAction(2000).moveTo(gallery, 10, center.y - location.y).release();

The waitAction(2000) does the trick here and delays the execution by 2 seconds, try using it.

1 Like

scrollTo() is deprecated.

Have you tried this on iOS, it seems in iOS device the speed is always the same irrespective of the value provided in the waitAction.

Tried and tested on android.

1 Like

How can scroll be performed with non deprecated methods now?
And which driver I need to use for this (AppiumDriver or AndroidDriver), I am so confused, cause for something I need one driver and for something I need another, and on the top of that I need to switch context cause I am testing Hybirid app.

Try older javaclient if you want to use deprecated methods. If not, then you must use TouchActions or UIAutomator class in order to scroll.

But there is problem when using waitAction after press: if there is an element, then pressing with waitAction will cause long-tapping element instead of scrolling. How do you solve this problem?

You can use UIAutomator and scroll within the scrollable view until the element is displayed.