Can findElementByAndroidUIAutomator find elements which are out of visible view on Android - Android Genymotion Emulator

My setup is:

  1. Appium 1.4.8
  2. Genymotion emulator - Android 4.4.4
  3. Appium Java Client 3.1.0

Issue:
Scroll had been working for me some days back but now it has stopped all of a sudden.
I perform scroll to a button which has text “Add to cart”. The button is not in the visible view of the screen hence I have been performing scroll so that the element comes in the view and I can click on it.

Now when I perform scrollTo(“Add to cart”), Appium performs a pull to refresh action on the view instead of scroll.
Ok, my next step was to look for a work around. I came across discussions which suggest to use findElementByAndroidUIAutomator to handle this. The links are:

  1. https://groups.google.com/forum/#!topic/appium-discuss/VjqWuNWwsqM
  2. https://groups.google.com/forum/#!topic/appium-discuss/ecY3qc2WXYg
    which talk about the problem that I am facing. But yet again, findElementByAndroidUIAutomator is failing when I try to find an element which is not visible but outside the visible view.

Can someone please tell me if findElementByAndroidUIAutomator actually finds element which are outside the visible view? If so, why is it failing?

in general for elements outside visible area:

  • with Android - not available
  • with iOS - available but you can’t e.g. tap on them

that is why you should define different strategies when perform tap on element. with Android it is always on screen with iOS you should check that element is visible.

@amedvedev Thanks for your response. Why is it then in those posts (URLs) that I have linked to they suggest using findElementByAndroidUIAutomator for elements outside visible view?
I was actually trying to perform scroll with the text as “Add to cart”. That is a button down in the view and the button is not visible. It’s not working. So I am looking out for another way.

i have no idea. but with Android we have do not have access to elements outside of device screen like with iOS. thus appium will not be able to predict in what direction to scroll :slight_smile: in attempt to make not visible element available.