Many issues with scroll_to Android + Appium + Ruby

Appium 1.6.3 using Ruby as the language to write tests for Android devices

The scroll_to method is not meeting our needs. I can get a test to work on some devices but not others. There are many issues around this call.

First you can’t have a spinner or other control that supports scroll_to in focus before you make the call otherwise it will scroll that widget instead of the screen. To get around that I have to click on a text field first but that brings up the keyboard. On some emulated devices the scroll will occur with the keyboard is visible - the Nexus 6P works fine, a Nexus 5 will not.

If I hide the keyboard after I click on the text control the focus returns to the top most control on the screen which happens to be a spinner which causes the scroll_to to break again as it scrolls the spinner and not the screen.

If I had a way to set focus to a control without the click we might be able to get around this issue. We also have the issue if all controls are spinners or other scroll based widgets on a screen I have no way to scroll because any control I set focus to will take over the scrolling and I can’t get to the screen scroll.

Next the scrolling only takes the text of control. I have a lot of controls that don’t have text or content descriptions. They are switches or spinners. For the spinner the data is loaded for the logged in user from the server. I have zero way of knowing at the time the test is run what that data will happen be be. I can not provide “text” to the work around scroll methods I have seen in other posts on this site.

We don’t have labels in front of our spinners so we can’t scroll to a label. We do have labels above groups of spinners but scrolling to that label does not guarantee the spinner below it will come into view. Since Appium depends on the control you want to access being in view and not just in the overall XML hierarchy this also causes many issues.

We need the ability to scroll to an item based on ID because there are times there is no way to have associated text.

There are so many limitation to the scroll_to that is has been impossible to write tests for our current displays. I hope there are some other quick work arounds so we can actually write tests that work on multiple devices.

@Kevin_Peck,

Thanks for all the details. We’ve stayed on Appium 1.4.[13|16] for quite some time because we knew the jump to 1.5+ was going to create lots of problems. We have a plan to start testing 1.6 in three to four weeks. I’ve collected the following discussion links on 1.6 and finding/scrolling; perhaps they will be of some use to you. I’ll also post here with my experience once I’ve gathered enough information to have an opinion.

Scrolling to an element

Find_element_by_name deprecation

I was having similar issues until I just started calling:
scroll_to('Element Text') and it was working pretty well.
It roughly centers it and then you can just do something like this for small changes in screens.
def swipe_a_bit x = $driver.window_size['width'] / 4 y = $driver.window_size['height'] / 4 $driver.swipe(start_x: x, start_y: y, offset_x: 100, offset_y: 40, duration: 500) end
I’m also using Appium Ruby on Android.