How to get WebElements which are Hidden below scroll in Hybrid App

Hi All,

I am trying to automate an app where i need to fill customer information form. In this form some text fields are visible and some text fields are hidden, which become visible only after scroll. All elements having same resource:id. So I am trying to fetch all elements into List like this

List < WebElement > allTextFields = driver.findElements(“Unique Id Value”) ;

But problem is I am getting WebElement values of only visible text fields and Hidden one are not picked by this command.

So lets say if I have 18 elements out of which 6 are visible and reset are visible only after scrolling(Next 6) and againg scrollng(last 6) and getting webelement values of visible 6 elements.

Need your thoughts/input on how to overcome this problem.

Thank you

List < WebElement > allTextFields = driver.findElements(“Unique Id Value”)

Above statement will fill in the list with list of visible elements. After scroll down you need to add those elements into the list again. You will have to go like this:

  1. Get the first and last visible elements position coordinates (X, Y)
  2. Swipe from last visible element to first visible element
  3. Get the visible elements again
  4. Append these elements (add into list) - make sure no duplicates are added
  5. Repeat this procedure until first and last visible elements are same and stop scrolling

You can maintain two separate lists. One is to have visible elements in it and second one is being used to fill in non-duplicate elements list of complete form which shall be used to fill the form.

Thank you Umar, Appreciate your help.
it helped me to some extent.
But there is one more problem, Since id identifiers for all text fields are same , it is overlapping with already filled one text fields, and entering values in already filled ones.

Is there is any to get track of each text field separately. Please suggest how to over come this problem.

Thanks again


There must be some index assigned to these fields. You can access through index.

You could use the getText method to retrieve the text that’s entered into the fields, and then start filling in fields again after finding a field that has not yet been filled in.

Yes that is another way. If you could share the snapshot of the elements or screen being automated that would be good.

Thank you afwang. Thank you again.
Solution provided by you worked and now its working fine.:smile::smile:

Thank you all for your support.