STOP_ON_FAILURE does not stop the execution?

Hello,
I am trying to wait for an element being visible and if not I want the test to stop.

WebUI.waitForElementVisible(findTestObject(‘CuPaDs/Color/Color’), 3, FailureHandling.STOP_ON_FAILURE)

This however does not end the testscript, it says ‘element not visible within 3 seconds’ but continues with the next steps then instead of stopping.

Any idea?

1 Like

Lukas,

The wait command raises a Warning message instead of exception so the test is not stopped. The ‘FailureHandling.STOP_ON_FAILURE’ is a little bit confusing. We will consider to make it right behavior.

In order to make the test stop, we could add assert for the command, for example:

assert WebUI.waitForElementVisible(findTestObject(‘CuPaDs/Color/Color’), 3, FailureHandling.STOP_ON_FAILURE)

If the element is not visible within 3 seconds, the wait command return false and will the assert will throw exception to stop the test.

2 Likes

Hi Trong_Bui
Using assert will not capture image when the test fails at that step. Is there any workaround for that?