How to swipe or scroll to the end of page in android app,

I want to swipe end of page but it swipe little bit and then stops .

Dimension dimensions = driver.manage().window().getSize();
Double screenHeightStart = dimensions.getHeight() * 0.70;
int scrollStart = screenHeightStart.intValue();
Double screenHeightEnd = dimensions.getHeight() * 0.03;
int scrollEnd = screenHeightEnd.intValue();
System.out.println(scrollStart);
System.out.println(scrollEnd);
driver.swipe(0,scrollStart,0,scrollEnd,5000);

You can use swipe on element by casting element to Mobile Element.
First file last element and perform swipe action on it.
e.g. ((MobileElement)Element).swipe(SwipeElementDirection.UP,100);

Here, in SwipeElementDirection, you can use UP,DOWN, LEFT, RIGHT etc as per your requirement.

1 Like