Accessing Elements that are off screen

Hi,

I’m new to Appium and Android automation, generally experienced in Web Automations using Selenium.

Recently we have been looking to automate our Android application, one thing I’ve noticed is that I can not find items unless they are visible on the screen, i.e. I need to scroll the page

Is this always the case? as I would find it difficult to automate when the screen resolutions are different, meaning less/more scrolling required.

Or am I missing some feature here?

Thanks in advance!

it is all true for Android - elements outside screen not visible. with iOS it is visible but need to be scrolled first if you want to tap on them.

So what is the best way to deal with different screen resolutions? Or is it best to design the tests best on one fixed set of devices?

not clear what the problem is?

Basically I have a Form that has many elements, you have to scroll vertically to see all of these. On different devices you have more or less scrolling to perform.

For instance a 480x800 resolution vs 1440x2560 resolution , the Form needs different amount of scrolling to get to elements. I see you can use ScrollTo() but the elements do not have a Name so would need to use Swipe() , defining the amount of scrolling required.

I am new at this and learning exch day what is possible, this may not be an issue just something I have to learn to overcome.

Thanks!

all correct. you need to scroll. As idea of end scroll you can choose any strategy:

  • either you know in advance the last element
  • or you should remember last element scroll and see if last element changed
1 Like

PaulB,

Its easy to handle different devices, you need to first check if element is displayed or not, if displayed then click else scroll a bit and again check. Keep this loop till you find element.

Hope you got an idea

Yeah that makes sense!

Guess I’ll write a custom function to do so :wink:

Thanks!

Hi, I am facing issue where I am trying to capture contents in a scroll view. Problem is that when I do findElements I am only getting data of what is visible. I need the entire data . I understand that I need to scroll to each data to do it. How can I scroll to a textnode and then get its parent to get all textnodes for that parent. Basically in the screenshot , I need to scroll to each match detail, I am thinking using first player name and get its parent viewgroup and then from that get all textnodes . How can I achieve this in appium java code.

1 Like

Hi, how can i scroll to element on ios if appuim see them as visible? i need to scroll to the exact place… how can i defined it?

-> http://appium.io/docs/en/writing-running-appium/tutorial/swipe-tutorial/