Unable to Find Element but Still Passing

I’m able to build my test to pass finding an element that is present. I’ve purposely built it to fail and it refuses to do so.

The final step is to Verify the Element is Present with the idea that the test will fail if the element isn’t present (it’s a link containing specific text). The test passes with a line in the Log that says “Unable to find the element…”

If it can’t find the element, why is it not failing?

Hi @jroman

Please let me see the test case and the console log. Check under Project > Settings > Test Design > Test Case and paste the screenshot here.

Hi @jroman Which version of Katalon are you using?

I have the same issue. If I recall correctly this would cause a “notSuchElementException”. Below screenshot shows a verifyElemntPresent on line 26 with an xpath that does not exist on the page. It does not find the element, doesn’t registers the error and continues execution.

Katalon version is 7.0.1

Have a look at the document of the verifyElementPresent keyword:

Please find there is 3rd argument FailureHandling. This argument is optional, defaulting to the value assigned by the UI Project>Settings>Test Design>Test Case>Default Failure Handling for Test Step

If you want you test case to fail and stop execution when the verifyElementPresent detected that the target Element has not come up on the view in 3 seconds, you can write:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.model.FailureHandling as FailureHandling
...

WebUI.verifyElementPresent(findTestObject('your test object path'), 3, 
    FailureHandling.STOP_ON_FAILURE)

As per the release note:

image

https://docs.katalon.com/katalon-studio/new/version-70.html#changes-and-improvements