verifyElementPresent method doesnt return false or stop on failed

I am using Katalon 7.0 and if use below script, it would not failed or stop the test even the object is not present on page. Same issue with this ticket , verifyElementVisible and verifyElementPresent not working with new 5.8.3 version Please advise

WebUI.verifyElementPresent(findTestObject('Page_My Account/span_Thank you for registering'), 30, FailureHandling.STOP_ON_FAILURE)

Hi @jerome.zhang

Please find the following release note:

There’s a fix:

Bug: [WebUI Keywords] The verifyElementPresent() and verifyElementNotPresent() keywords should return false instead of throwing an exception when the verified elements do not exist.

hi , i am using 7.0.6, was this issue fixed in 7.0.7?

Hi @jerome.zhang

That’s not what I meant. I meant the documented behavior of verifyElementPresent should return false instead of throwing error, but in earlier versions it actually throws the exception. If you want your test to stop when an element is not present, then please explicitly use KeywordUtil.markFail

Hello @ThanhTo this issue is still happening on version 8.5.5, do you have any idea of what version this is going to be resolve?

If you do not like verifyElementPresent keyworkd which throws Exception, then you should use waitForElementPresent keyword which works the same as verifyElementPresent. And waitForElementPresent throws no Exception and return false when the target element is found absent after the specified timeout seconds.

By the way, you can read the source code of the Keywrods:

You can be sure only by reading the source code of the recent version.

I think that Katalon team is NOT going to change the behavior of “verifyElementPresent” in future.

1 Like