WebUI.verifyElementPresent question


I using this code

if( WebUI.verifyElementPresent( findTestObject( ‘Object repository/Error/error404’), 5, FailureHandling.OPTIONAL)){

WebUI.comment(" ERROR 404")


but when verifyElementPresent is false I get a screenshot too. I don’t understand why :frowning:
Can anyone help to me? verifyElementPresent take a screenshot automaticlly or what happend?


1 Like

I am also facing the same issue. It takes screenshot automatically whenever we verify whether the element is present or not. Even if the conditions are true but there are some info.

Possibly your Project > Settings > Report has “Take screenshot when execution failed” toggled ON. Therefore verifyElementPreset() takes screenshot when it failed.

You can toggle it off, then no screenshot will be taken.

Alternatively you want to switch verifyElementPresent() to waitForElementPresent(), which will NOT fail (this means, no StepFailedException with be thrown) so that no screenshot will be taken.