Scroll a page with scrollable elements inside

Hi all,
I’m trying to automate an iOS app. On a screen, it has a scrollable element, for example, Google map.
How can I scroll the page outside of the map? To scroll the page itself, not the map?

Down the screen, there are other elements and I want to scroll down until one of them is visible, but that element is not plotted to page source until the page scrolls down, so I can not scroll to an element.

So, ultimately, I just need to scroll the screen with a map until some element is visible.


I don’t know in which language you code but you can try something like:
TouchActions action = new TouchActions(driver);
action.scroll(element, 10, 100);

You can also swipe using Dimensions.

Hi Serge,

Try below code to swipe the screen:

TouchAction action = new TouchAction(driver);
PointOption p1= new PointOption();
Dimension dimensions = driver.manage().window().getSize();
Double screenHeightStart = dimensions.getHeight() * 0.5;
int h1 = screenHeightStart.intValue();
Double screenHeightEnd = dimensions.getHeight() * 0.2;
int h2 = screenHeightEnd.intValue(); point (0,h1))
.waitAction(new WaitOptions().withDuration(Duration.ofMillis(600)))
.moveTo(PointOption.point(0, h2))

Thanks everyone.
The solution I found is … there is no solution. All of the above suggestions (and many others I have tried) will just scroll the map.
The only viable option is to touch/press some ‘not scrollable’ point on the page and move it.

Thanks again.

Hi Serge,
I appreciate your response, but what will do if we have elements listed in this manner that each element is highlighting and if tries to inspect Scroll provided, then not able to inspect scroll

Confused now. Are we talking slow scrolling, or are we talking “swipe”, swipe is totally different to the suggested scrolling technique. In my app I recently used dragFromToForDuration() I had to specify a duration > 2000 ms for it to work reliably. I assume this is what you also tried Serge?

When you do this as a human, are you dragging, or swiping?