Cant verify if element is not present on site

Hello again,

Can someone tell me why those test fail?
I want to verify if element is not present on site. They are not, im using global variable for that,
See screenshots.

I am not sure your global variable (Barrier_page) is correct. Can you show us that you have assigned to it ?

Add a Failure condition to it like
boolean elemPresent = WebUI.verifyElementNotPresent(GlobalVariable.Barrier_page,0, FailureHandling.OPTIONAL)
println elemPresent

If I remember correctly, WebUI.verifyelementNotPresent always throw an exception when it fails. If you want assign the result for a boolean, you have to use WebUI.WaitForElementNotPresent()

Verify statement can also be assigned to boolean

What do you mean? What have i assigned to it?

If i change it to WebUI.WaitForElementNotPresent() im getting this

of course element is not present on site

Your global variable “Barier_page” is probably a type String.
When you are using WebUI.verifyElementNotPresent(GlobalVariable.Barrier_page,0), it replace GlobalVariable.Barrier_page with the String you have setup.
The first parameter of this function must be a test object, not a string.

Or is your variable a test object ?

My variable is test object
Screenshot_84

Sorry, I missed your other message where you changed for “WaitForElementPresent”. Also, this show us the element is present, so it’s normal that when you try to “VerifyElementNotPresent” it always fail because the element is present.

Yea but the point is that element is not present xd

The element is not present or the element is not visible ? It can be present on the DOM but not visible to your eyes. It’s two different things.

I know but its not present at all on site.