Scroll up method shall Tap on the element over the screen


#1

Dear Experts, I use below code for Scroll up. My Native app has ecomm product images, they all needs to be scrolled up until we see Continue button to click on moving to the next page. My below code shall scroll up and it touches images and this will navigate to unexpected other screen. Ultimately i don’t need this code to touch on these images and in fact i need scroll to continue until i reach end of the page and click on Continue button to Navigate to Next screen. Any suggestions?

public void scrollUp_Android(AndroidDriver driver) {

	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();
	(new TouchAction(driver)).press(PointOption.point(0, 0)).moveTo(PointOption.point(scrollStart, scrollEnd))
			.waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000))).release().perform();
		
}

#2

Try this driver.findElementsByAndroidUIAutomator(“new UiScrollable(new UiSelector()).scrollIntoView(text(“Continue”));”);

See if this works .