2

I am trying to use AndroidViewClient for ScrollViews. Here's a scenario from the Android Settings Screen: 1. Launch the settings page, do a ./dump.py, it will generate all the ids etc. 2. Scroll the settings page down, do another ./dump.py. The Android View Client generates the same ids for the new screen.

For my project, I am identifying the object based on the IDs, so if the elements I want to click on the 2nd screen (after scroll) get's the same ID as the first screen. The test will fail. Is there some API to handle the Scroll Views which lists the element IDs outside what we see on the screen.

Has any one tried this?

Nitin
  • 21
  • 1

1 Answers1

2

You could keep track of Id's in your script but it would be very difficult.

When AndroidViewClient is used with the UiAutomator back-end, this back-end does not provide IDs so AndroidViewClient provides the facility of assigning UniqueIds to the Views on the screen. These UniqueIds are reassigned between one call to vc.dump() and the next. The only way I can think of keeping track of Ids while you scroll is to use the text or content description of the Views, but this can be simply done by the script, which also has some knowledge of what's presented.

Having said that, my recommendation is sticking to text or content description of the Views to find them after scrolling.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134