[Mobile] Wait For Element Not Present
Description
Wait for the given element to NOT be present within the given time (in seconds).
Keyword name: Mobile.waitForElementNotPresent
Parameters
Parameter | Parameter Type | Required | Description |
---|---|---|---|
to | TestObject | Yes | Represent a mobile element. |
timeout | Integer | Yes | The maximum period of time in seconds that system will wait to return a result.
|
flowControl | FailureHandling | Optional | Specify failure handling schema to determine whether the execution should be allowed to continue or stop. |
See also: Understand waiting keywords
Returns
Parameter Type | Description |
---|---|
boolean |
|
Example
In this example, Studio waits for the Accessibility element to be gone within 10 seconds then continues testing. If the Accessibility element is still present, the keyword returns False and throws a warning message, and goes on with the following steps.
//Start Application
Mobile.startApplication(GlobalVariable.G_AndroidApp, false)
// Wait for the first element to present
Mobile.waitForElementPresent(findTestObject('Application/android.widget.TextView - Accessibility'), 10)
// Verify if the element's text is correct
Mobile.verifyElementText(findTestObject('Application/android.widget.TextView - Accessibility'), 'Accessibility', FailureHandling.CONTINUE_ON_FAILURE)
//Tap on OS
Mobile.tap(findTestObject('Object Repository/Application/android.widget.TextView - OS'), 0)
//Wait for the Accessibility element to be gone on the next screen
Mobile.waitForElementNotPresent(findTestObject('Application/android.widget.TextView - Accessibility'), 10)
//Then tap on MMS Messaging element
Mobile.tap(findTestObject('Object Repository/Application/android.widget.TextView - MMS Messaging '), 0)