I am using STOP_ON_FAILURE, with if statement. If object does not apeear even then test casae execution is stopped. Here is the script:
if (WebUI.verifyElementPresent(findTestObject(‘Object Repository/Error_handling_RBA_IMPACTT_web/Error_Messagee_Error_Handle_pop_outt’),
5, FailureHandling.STOP_ON_FAILURE)) {
WebUI.delay(5)
}
Is there any workaround?
Thanks.
STOP_ON_FAILURE means, when there is a FAILURE, STOP the test.
I think maybe you want CONTINUE_ON_FAILURE.
Issue I am facing is, even the element is not present the test case execution is stopped. According to my understanding, if the element given in ‘if’ statement is present then test case should stop otherwise it should continue to next statement. But test case execution is stopped in any case.
How Should I handle it?
Because you told it to STOP.

Should’t it stop when it finds the object “Error_Messagee_Error_Handle_pop_outt”?
It stops even this object is not present.
verifyElementPresent
means check if the element is present (in the DOM). It returns TRUE if the element is present. It returns FALSE if the element is NOT present. VERIFY, in this context, is like ASSERT, where a FALSE is considered a FAILURE.
But WebUI.verifyElementPresent()
allows you take control over the assertion using FailureHandling. Because you used STOP_ON_FAILURE verifyElementPresent
is behaving like a proper ASSERT and stopping your test.
I BELIEVE YOU WANT CONTINUE_ON_FAILURE
From this code, it looks to me like you are trying to implement a wait condition. Why not just use the waitForElementPresent()
method?
To Russ’s point though, I think you are misunderstanding the FailureHandling.STOP_ON_FAILURE
argument. You are telling the whole script to stop execution (not just the method) if the verifyElementPresent()
call returns false
, which means your if()
statement is not even executed at all.
Thanks for your response. @Russ_Thomas as you suggested, I am using “Continue” . It is working for me. We can close the comments for this query.