iOS-Scroll/Swipe > How to control the speed of swipe?

Appium : 1.6.5
Java-client 5.0.0

In Android, the speed of the swipe can be controlled by varying the parameter inside the waitAction() method.

But the same is not working in iOS. Irrespective of the time value passed in waitAction(), the speed of swipe seems constant in iOS.
TouchAction tc = new TouchAction(driver); (xMax * 0.1), (int) (yMax * 0.35)).waitAction(Duration.ofMillis(200))
.moveTo((int) (xMax * 0.1), (int) (yMax * 0.75)).release().perform();

I used JavaScriptExecutor also ,but the result was the same.

Please let me know your comments.

thanks in advance!

Hey there,

In my swipe with js experiences, scroll method has a slower swipe, and I have managed to increase the duration with dragFromToForDuration

Iā€™m leaving the code blocks below, hope that it may help. I had some problems on 1.6.4 but worked on 1.6.5

public void scrollDown_js() {
		Map<String, Object> params = new HashMap<>();
		params.put("direction", "down");
		driver.executeScript("mobile: scroll", params);

public void dragFromToForDuration(By elementBy,int xStartRatio, int yStartRatio, int xEndRatio, int yEndRatio, double durationSecond){
		MobileElement element = waitForElement(elementBy);
		Dimension d = driver.manage().window().getSize();
		int height = d.height;
		int width = d.width;
		int swipeStartWidth = (width * xStartRatio)/100;
		int swipeEndWidth = (width * xEndRatio)/100;
		int swipeStartHeight = (height * yStartRatio) / 100;
		int swipeEndHeight = (height * yEndRatio) / 100;
		Map<String, Object> params = new HashMap<>();
		params.put("duration", durationSecond);
		params.put("fromX", swipeStartWidth);
		params.put("fromY", swipeStartHeight);
		params.put("toX", swipeEndWidth);
		params.put("toY", swipeEndHeight);
		params.put("element", element.getId());
		driver.executeScript("mobile: dragFromToForDuration", params);
1 Like