Swipe() function does not work on a text heavy web view of a mobile application

As a part of my automation script I am required to swipe on the terms and conditions page of a mobile app that is currently being developed. So I have used the swipe( ) function that is provided as a part of the appium java client version 4.1.2, but what happens is the swipe( ) does work but at some point in the continuous swiping process the swipe stops working and the function seems to select texts from the page instead!

below is a code I have used:

Iterator iterate = listOfTexts.iterator();

       WebElement web = iterate.next();
       MobileElement we = (MobileElement) web;
       we.swipe(SwipeElementDirection.UP, 1000);

listOfTexts is just all lines of texts available on the webView.

I am using appium version 1.5.3 with java client 4.1.2 and the tests are on mobile iOS version 9.3.3.


Try this

Dimension dimensions = driver.manage().window().getSize();
Double screenHeightStart = dimensions.getHeight() * 0.5;
int scrollStart = screenHeightStart.intValue();
Double screenHeightEnd = dimensions.getHeight() * 0.2;
int scrollEnd = screenHeightEnd.intValue();
driver.swipe(0, scrollStart, 0, scrollEnd, 2000);

Thank you very much for your response. Unfortunately, that doesn’t do anything when executed. I am assuming this is due to the fact that you have set the x coordinate to 0.