How to verifiyElementExist in listeners?


I want to do a recovery scenario in case my previous test is failed.
In the listeners I would like to check if an object exists.
In the @AfterTestCase if I am on the login page then everything is OK, otherwise I have to close my application.

In my code findTestObject is underline and not recognized.

In y listener :

def AfterTestCaseRC(TestCaseContext testCaseContext) {
def bPageLogin = Mobile.verifyElementExist(findTestObject(‘Object Repository/login_editText’),1, FailureHandling.OPTIONAL)
if (bPageLogin) {
Mobile.comment(‘nothing to do’)
} else {


you have few choices:

  1. global variable/local variable - store information about execution there and read in listener in case of local variable - can be accessed using testCseContext
  2. check status of test case from testCaseContext
  3. probably something other cannot figure it right now - sorry X-mass brain-coma

Thanks for your answer !
I will choose choice 3 ! :santa:
Merry Christmas

1 Like