Protractor Check if Element Does Not Exist

I have a setting in my angular based website that turns a dropdown on and off. If it is off, then it does not show on the main page.

With Protractor, I need to check to see if this element is not present when the switch is off. However, I should not be thrown into Element Not Found Error, as it is one test in a set of many. How should I do this?

I have tried to do:


But I am getting an AssertionError with this…


Got the thing working by using something I found in the docs:


Also uses assertions, so it doesn’t break cucumberjs.

Leave a Reply

Your email address will not be published. Required fields are marked *