Native Android app: While swiping from one page to another, page swipes a little but does not go to next / previous page

I am trying to automate one news app on Android. This app consists of section pages placed horizontally. While swiping horiztonally from one section page to another, the swipe misses (page swipes a little but does not go to next / previous page) and does not go to the next / previous page. This issue occurs intermittently. Is there any way to handle swipe-miss in appium? Here is swipe code I am using for swiping from right to left:

int startX = (int) (getDeviceSize(androidDriver).width * 0.80);
int endX = (int) (getDeviceSize(androidDriver).width * 0.20);
int startY = (int) (getDeviceSize(androidDriver).height * 0.70);

androidDriver.swipe(startX, startY, endX, startY, 1000);

Pass it using Javascript it would work better.

@Mobile_Test_Test Thanks for your quick answer :slight_smile: Could you please give an example how to do it using Javascript? I am new to mobile automation hence do not know much

           Dimension screenSize = driver.manage().window().getSize();                

            int startX = (int) (screenSize1.getWidth()/0.9);
	int startY = (int) (screenSize1.getHeight()/2);

	int endX = (int) (screenSize1.getWidth()/0.1);
	int endY = startY;

           driver.swipe(startX, startY, endX, endY, 3000);