If element not visible - using verifyElementNotVisible boolean return value


My if statement seems to be stoping on the if block and not continuing onto the else block, ive ran the script when its true and it runs fine but when the element is visible i want the else block to run. Ive looked on a few other topics but nothing seems to work for me. I assume its just a failure handling issue and im doing it wrong.

if (WebUI.verifyElementNotVisible(findTestObject(‘V9.1 Testing/Page_CIPHR Self Service 9.1.0/span_HR Admin’)))
WebUI.click(findTestObject(‘V9.1 Testing/Page_CIPHR Self Service 9.1.0/span_Log Out_glyphicons glyphi’))

WebUI.click(findTestObject(‘V9.1 Testing/Page_CIPHR Self Service 9.1.0/span_HR Admin’))
WebUI.click(findTestObject(‘V9.1 Testing/Page_CIPHR Self Service 9.1.0/span_HR Admin’))

1 Like


WebUI.verifyElementNotVisible(findTestObject(...), FailureHandling.CONTINUE_ON_FAILURE)

I notice the docs are both weak (no treatment of the boolean return value in the examples) and in error (using a timeout not mentioned in the spec). https://docs.katalon.com/katalon-studio/docs/webui-verify-element-not-visible.html


Great, thought it would be something like that - thanks mate :slight_smile:


Hi folks.

Thanks for the report, I added it into our back log and we will fix the documentation to be more consistent.


Regards !


Just going to add this, after using continue on failure the test would be marked as a fail even though it passes becuase the if statement is a variable that will change - this worked for me

1 Like