Stay organized with collections
Save and categorize content based on your preferences.
UiWatcher
public
interface
UiWatcher
android.support.test.uiautomator.UiWatcher
See registerWatcher(String, UiWatcher) on how to register a
a condition watcher to be called by the automation library. The automation library will
invoke checkForCondition() only when a regular API call is in retry mode because it is unable
to locate its selector yet. Only during this time, the watchers are invoked to check if there is
something else unexpected on the screen.
Custom handler that is automatically called when the testing framework is unable to
find a match using the UiSelector
When the framework is in the process of matching a UiSelector and it
is unable to match any widget based on the specified criteria in the selector,
the framework will perform retries for a predetermined time, waiting for the display
to update and show the desired widget.
Public methods
checkForCondition
boolean checkForCondition ()
Custom handler that is automatically called when the testing framework is unable to
find a match using the UiSelector
When the framework is in the process of matching a UiSelector and it
is unable to match any widget based on the specified criteria in the selector,
the framework will perform retries for a predetermined time, waiting for the display
to update and show the desired widget. While the framework is in this state, it will call
registered watchers' checkForCondition(). This gives the registered watchers a chance
to take a look at the display and see if there is a recognized condition that can be
handled and in doing so allowing the current test to continue.
An example usage would be to look for dialogs popped due to other background
processes requesting user attention and have nothing to do with the application
currently under test.
Returns
boolean
true to indicate a matched condition or false for nothing was matched
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-04-11 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-11 UTC."]]