Ui device wait until button visible


Is it possible to By search for an id, for example an id of a button? I want to have my Ui Device wait until the button is visible. Currently I have

UiDevice.wait(Until.findObject(By.text("Text on Button")), wait_time).action();

But searching by text seems to be inconsistent between devices, not sure why. I wanted to test searching by object id since that seems like it would be more consistent.


This should work:

UiDevice.wait(Until.findObject(By.res("com.example.app:id/button")), wait_time).action();

Answered By – Diego Torres Milano

Leave a Comment