Skip to content

Commit

Permalink
Android Automator: fix IndexOutOfBounds exception when waiting for na…
Browse files Browse the repository at this point in the history
…tive view (#939)

to become visible
  • Loading branch information
bartekpacia authored Feb 15, 2023
1 parent 9c7a4cc commit dde1d47
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ class Automator private constructor() {
private fun waitForSelector(bySelector: BySelector, index: Int): Boolean {
val startTime = System.currentTimeMillis()
while (System.currentTimeMillis() - startTime < timeoutMillis) {
if (uiDevice.findObjects(bySelector)[index] != null) {
val objects = uiDevice.findObjects(bySelector)
if (objects.size > index && objects[index] != null) {
return true
}

Expand Down

0 comments on commit dde1d47

Please sign in to comment.