How to define a scrolling long in “katalon-mobile-util” liberary?

I’m using " katalon-mobile-utils " from detroitlabs for Katalon studio and it’s working well.

My problem is to define an exact Y Coordinate traveling in this method:

Swipe.swipe(SwipeDirection.BOTTOM_TO_TOP)

It means: dY= endY-startY

Link of the library:

@Chris_Trevarthen -tnx

Hi @monfareddm,

If I understand correctly, you want to be able to swipe from the bottom to top but you also want to specify the starting and ending y-coordinates?

Right now, katalon-mobile-util doesn’t offer that function, but you could add the following to your test to do it:

import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.AppiumDriver
import io.appium.java_client.TouchAction
import io.appium.java_client.touch.offset.PointOption

AppiumDriver<?> driver = MobileDriverFactory.getDriver();
TouchAction touchAction = new TouchAction(driver);

int startX = 100 // just some value as long as it's the same as endX
int endX = 100 // just some value as long as it's the same as startX
int startY = 1000 // set your starting value here
int endY = 100 // send your ending value here

touchAction.longPress(PointOption.point(startX, startY)).moveTo(PointOption.point(endX, endY)).release().perform();

Hope this helps,

Chris

Hi @Chris_Trevarthen
Thank you for this. And I’m sorry if I’m not very well in English.

I know this method but the speed of swiping is out of control here.
For example if you try (startX=100,startY=3500) to (endx=100,endY=1000) the speed of swiping makes UIAutomater reaches to near 700 instead of 1000. Because it did too long swiping and when it releases his finger, the page would continue swiping for a moments.

So for controlling the speed, I tried to use katalon-mobile-util cause I found the speed is almost fixed in this library.
But my problem with Swipe.swipe(SwipeDirection.BOTTOM_TO_TOP) now is that I can’t define a start/end coordinates with fixed speed.

Clearly I’m looking for a method where I can control both speed and coordinates.

Hi @monfareddm,

I’m not doing anything special in the Swipe class to control the swipe speed, in fact, I haven’t found any documentation in Appium where you can actually do that. I’m thinking that the timing of the actions is constant, but since the start and end positions are different, that’s affecting the speed. So, if you want to make the scrolling “slower”, you could try to decrease the distance between the start and end points.

Hope this helps,

Chris

1 Like