Using UIAutomator2, how to scroll to bottom of the list? I have very long list and I need to test each item in that list. I created ‘contentDescription’ for each item so I have “Item_XX” (where XX is position/index in list), but before I start checking items one by one, I need to know which ItemId is last…
Is my only way how to do it just do multiple scrolls until I hit end? Is there any way how to scroll just to bottom and detect, that I am on bottom?
If you only have access to application accessibility layer then it is impossible to figure out the exact scroll duration. That is why scrolls are done in a loop and on each loop iteration the algorithm should verify if the condition that stops the scrolling is satisfied. UiScollable stuff, btw, does exactly the same manipulations, just implicitly. In Espresso though, there is a way to achieve something like that using android datamatcher location strategy. See, for example, https://www.youtube.com/watch?v=gU9EEUV5n9U