So i work on a native application with Android 4.4+
I use the java client 1.5.
I have an activity with :
-spinner, some button and then a RecycleView.
I want to scroll in the recycleview. Each row have a specific height wich i can compute. So to scroll one row i do this : ( this is pseudocode )
I compute each coordinate. With rowElement.getLocation().getX()
And
rowElement.getSize().getHeight() …
It should scroll for all the height of the row. But it doesnt scroll entirely. Why ?
( i got the same size and position from the uiautomationviewer and the code )
Hi, well the problem is that since i have a spinner and a recycle view.
When i use scrollTo it target the spinner. And it doesnt scroll the
recycleview. ( the spinner is before the recycleview ) is there a way to
specify wich list to target ?
I think this might be the internal “slop” property built into the Android system. Scrolling in Android was designed so that if the user moves their finger a tiny bit on the screen while tapping, the system will still recognize it as a “tap”. This is necessary because when a human finger taps on the Android screen, rarely will the tap position remain precisely on a particular position on the screen. Slop, then, defines the cutoff point between when a touch+move will count as a tap and when the touch+move will count as swiping (or scrolling in WebDriver terminology).
The slop value is actually quite sizable (somewhere on the order of 10% of 1 inch). It can be queried using the Android ViewConfiguration class. However, I do not think Appium currently provides a way to query this class for information (Feel free to correct me here if I’m wrong, though! Would be an interesting feature to request if this feature isn’t already implemented).
When I was implementing screenshot comparison I have encountered the same problem - scroll was completely inconsistent.
After trying different approaches I have finally found the one that works.
I used pressKeyCode() method with KEYCODE_DPAD_DOWN/KEYCODE_DPAD_UP as a parameter to navigate back and forth.
However, there is a catch - the View you want to navigate to has to be focusable (you can set android:focusable=true in XML layout).