Appium 1.5 iOS execute script mobile scroll

I’m using Appium 1.5 with ruby. The targeted test device is an iPhone 6 on iOS 8.4. I’ve been trying to scroll to an element that’s not visible on the screen - prior to Appium 1.5 I was able to use scrollTo for this. I’ve changed the method to the following:

$driver.execute_script ‘mobile: scroll’, direction: ‘down’, element: screen.last_trans_first_page.element.ref

But this doesn’t seem to scroll to the element, instead it only scrolls for one page in the direction specified. I need the exact scroll - if anyone has any experience with it will be awesome!

Also I’ve tried using TouchAction.move_to but it won’t take the element that’s outside of the screen.

Thanks a lot in advance!

execute_script “mobile: scroll”, :direction => “down”, :element => element.ref

Try to do this :slight_smile:

Thanks but I’ve already tried that - I don’t think it’s the syntax.

Since mobile: scrollTo has been deprecated I’ve been trying mobile: scroll exactly as you are, but in Python, and am experiencing the same issue. It just scrolls the screen one page then stops… leaving the target element still out of view.

        el = self.driver.find_element_by_xpath(self.locator)
        self.driver.execute_script("mobile: scroll", {"direction": 'down', 'element': el})

Apparently this is working exactly as designed per this Git bug report:

I’ll research more, but that bug report seems to indicate we’re going to be forced to craft our own custom functions to handle scrolling items into view, just like we have to do with Android.

Thanks a lot! At least now I know I’m not crazy. Haha.