I have a decent suite of Python based iOS tests working well, including scrolling, locating elements, working with large tables, etc. Bingo!
I’m venturing into Android automation and am hoping someone can save me hours of research and point me to some concise documentation on how to deal with screens with large ListView containers that have lots of LinearLayout rows, most of which will be out of the viewable area?
Some problem areas I need to tackle:
- Android find_element functions fail to locate the element if it is out of view since the page XML only includes visible elements. Surprise! iOS doesn’t have this same issue, the full page XML is available so you can locate items 10 page scrolls out of view.
- So I’ll have to scroll the page in hopes of finding the element. Which is probably fine if I know exactly which element I’m looking for. But that’s not always the case as a lot of my data is dynamic and unknown.
- I have a lot of tests that require knowledge of how many rows of data are displayed. On iOS I can simply:
cells = self.driver.find_elements_by_xpath('//UIATableView/UIATableCell')and have everything I need. Since the Android page XML doesn’t include items out of view I need to come up with some clever function that can scroll the page and count up the rows. And know when I’ve scrolled to the end of the list. There could be 10, 34, or 300. I’m assuming 100 people have already figured this out and can throw some code my way.
- Many of my lists are composed of dynamic data. The row will physically be rendered, but one or more may have “Loading…” in the row until the APIs respond with all of the data. On iOS for simplicity’s sake I simply poll all of the UIATableCell until the ActivitySpinner disappears, repeat for every row. This can take up to 120 seconds max. This ensures the whole page has loaded so none of the tests proceed until all of the potentially dependent data is available. Once I crack the case on scrolling this should be easy to do on Android, too.