Does anyone have a scroll-to-top solution for mobile testing?

As I understand it, there’s a relatively simple way to scroll to the top of the page using WebUI keywords (WebUI.scrollToPosition(x,y)), but I can’t seem to find a built-in equivalent for mobile testing. In my particular case, Mobile.scrollToText() won’t work, because there is no specific text at the top of the page. Has anyone found or created a consistent means scrolling to the top of a mobile page?

Thanks!

@joshw I do not know of a universal way to scroll to the top on mobile. What I have done in the past is found something that would be at the top of the list and then scroll to it. If it is a dynamic list then when I first load the list I save the first object in the list and then wrote a scroll function to scroll up to that item in the list using the Mobile.swipe command using relative x,y points based on deviceHeight and deviceWidth. The other option I have used is if there is a spinner indicator on a pull to refresh then I scroll up until I see that spinner.

1 Like