Successfully modified file: /home/Messier82/projects/service-book/app/src/androidTest/java/com/yorvana/testsupport/SystemPicker.kt (1 replacements). Here is the updated code: ... ) { val objectByText = device.wait(Until.findObject(By.text(text)), TIMEOUT_MILLIS) ?: device.wait(Until.findObject(By.textContains(text)), TIMEOUT_MILLIS) ?: error("System picker item not found: $text") device.waitForIdle() try { objectByText.click() } catch (e: Exception) { // Retry once if stale or other transient issue device.wait(Until.findObject(By.text(text)), TIMEOUT_MILLIS)?.click() ?: throw e } } }