Default keywords related to element checks e.g. verifyElementPresent , returns exception instead of boolean false

Commands like verifyElementVisible, verifyElementNotVisible, verifyElementPresent, verifyElementNotPresent, verifyElementHasAttribute, etc. returns an exceptions instead of boolean false if the condition fails.

All these commands are marked with return type as boolean, however, there is no proper handling to it and throws exception if condition fails.

As a workaround, I am using it like below , bu this is not an optimal solution as you end up with unwanted warnings in the console logs.
if (WebUI.verifyElementNotPresent(findTestObject(‘ab/xyz/rrr’),10,FailureHandling.OPTIONAL)

1 Like


you’re true, currently there’s no way how to do it without warnings. If you don’t like it, you can write your own method for presence validation.

def boolean isElementPresent(TestObject to) {
	try {
		WebUiCommonHelper.findWebElement(to, 1)
	} catch (WebElementNotFoundException ex) {
		return false
	return true

And call this one instead of native WebUI keywords.

1 Like

Thanks, will check on this one.

But with this solution, I will end up creating hell lot of custom methods corresponding to different verify… methods which I will consume.

True. And I’m sorry I can’t help you better now.

You can create a feature request to introduce new FailureHandling value, which won’t write anything into logs and it just returns boolean value.

Hey, Thanks for the help and don’t be sorry. Appreciate your help here.

I really cannot categorize this as a new feature for Katalon team, its a defect in existing code itself that should get fixed in the product. I am not sure if a defect is already logged for this or not.

I’d say it’s more like non-existing feature - I also use FailureHandling.OPTIONAL for preventing exceptions, but I don’t care about warnings - but I agree, it may be annoying.

@devalex88 @ThanhTo Guys, could you create this feature request and prioritize it in your project? Thank you!


Thank you all for the report. The behavior will be corrected in Katalon Studio 6.4.0.


Awesome. Thanks much for the update !!

Hi everyone,

In Katalon Studio 7.0.0, we have already fixed the bug that caused the verifyElementPresent() and verifyElementNotPresent() keywords to throw an exception instead of returning false when the verified elements do not exist.

Please first check out the release note and click here to download if you want to try version 7.0.0 (beta) in advance.

Happy Testing!


Thanks Jass for the fix and update.

Wanted to know if the fix is limited to verifyElementPresent() & verifyElementNotPresent() only , or its applicable to other verify functions too ?

I believe its important to have this behavior consistent across other verifyElement*** keywords too.

It’s only for the two keywords. Other keywords still require that the elements exist. You can combine them with verifyElementPresent() and verifyElementNotPresent().

What if there is need to check :

  1. if element has/not has the given attribute
  2. if element visible/not visible
  3. if element checked/not checked
  4. etc.

The workaround you suggested to use verifyElementPresent/verifyElementNotPresent , won’t work here :(.


You can use something like verifyElementPresent() && verifyElementHasAttribute().

I am aware these functions :slight_smile: , but what I was trying to share that while consuming these methods , they will not return false rather returns an exception.

Hence, the issue raised for verifyElementPresent is applicable to other verify** methods too !!