Ask Katalon Anything - Sep 6 to Sep 22, 2023 💬

Question: User Unexpected behavior I noticed in Katalon Studio. When using the methods WebUI.verifyElementNotPresent or WebUI.verifyElementPresent with the following syntax’
TestObject export_button = findTestObject(‘imging/action_export_button’)
button_state = WebUI.verifyElementVisible(export_button) and expect a returned boolean.
If the element is not present, it fails the test at this step. Even though Katalon indicates that it will return a boolean value based on element’s presents or not.

The only way I was able to get this to work is by using the Failure Handling and it has to use the OPTIONAL option not CONTINUE. Then even when using OPTIONAL I still see a warning level event when the element is not visible. WebUI.verifyElementVisible(export_button, FailureHandling.OPTIONAL)

What I expected with these methods is a cleaner exit of returning a boolean if the element is present or not and the step to continue. I didn’t expect the verifyElementPresents to be a hard assertion failure and stop the test. Is this the correct usage of these methods? I’ve seen other Selenium implementations where there were methods that can check the element presents and return a boolean and allow the test steps to continue -versus- an assertion method that will hard fail the test step.
Mike W.