Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,28 @@ public static void handleButtonClickForObjectWithTextSafely(@NonNull final Strin
}
}


/**
* Clicks the button element that contains the supplied text.
* Do not throw an exception if the button is not found. Waits
* for the button to exist with the supplied timeout before giving up
* and logging a warning.
*
* @param text the text on the button to click
* @param existsTimeout the maximum time to wait, in milliseconds, for the button
* to exist before giving up and logging a warning
*/
public static void handleButtonClickForObjectWithTextSafely(@NonNull final String text, final long existsTimeout) {
final UiObject button = obtainUiObjectWithText(text, existsTimeout);

try {
button.click();
} catch (final UiObjectNotFoundException e) {
Logger.w(TAG, "Button with text \"" + text + "\" was not found after waiting "
+ existsTimeout + " ms: " + e.getMessage());
}
}

/**
* Clicks the button element that contains text matching the supplied regex
*/
Expand Down
Loading