How to verify that element doesn't exist

Hello, I have problem with validating that element is not present on the page. This seems to me like a basic thing, but I am not able to verify it.

Example: I want to test filtering on our web and I want to verify that exact record is not present.
I tried to use “Get Element States id=record1 contains hidden” but it fails as it doesnt finds it at all
([ FAIL ] Elements states ‘[‘detached’]’ (list) should contain ‘[‘visible’]’ (list))
I also tried to use “Run Keyword And Expect Error” but it always pause my execution and wants me to press Enter to continue.

Please can you advise me on how to aproach this?

Hi Pavel,

Have you tried detached?

Dave.

From the documentation:

1 Like

Get Element Count yourSelector == 0

https://marketsquare.github.io/robotframework-browser/Browser.html#Get%20Element%20Count

2 Likes

Thanks a lot :heart: I am new in this and I was pretty sceptical about writing on forum, but theese fast and helpful asnswers really brightened my day. Love you guys :)))

1 Like