Skip to main content

[Mobile] Wait For Element Not Present

Description

Wait for the given element to NOT be present within the given time (in seconds).

Important:
  • Katalon Studio version 8.1.0 onwards.

Parameters

Parameter Parameter Type Mandatory Description
to TestObjectRequiredRepresent a mobile element.
timeout IntegerRequired

The maximum period of time in seconds that system will wait to return a result.

  • If timeout > 0, Katalon Studio waits timeout to return a result.

  • If timeout = 0, Katalon Studio uses the default wait for element timeout in Project Settings.

  • If timeout < 0, Katalon Studio throws IllegalArgumentException.

flowControl FailureHandlingOptionalSpecify failure handling schema to determine whether the execution should be allowed to continue or stop.

See also: Understand waiting keywords

Returns

Parameter TypeDescription
boolean
  • true: the element is NOT present within the given timeout.

  • false: the element is present within the given timeout.

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)