Use element by css to check if element exists in Protractor
You need to test if the element is not present:
expect(element(by.css('.elementClass')).isPresent()).toBe(false);
You can test whether the element
is present with isPresent
. Here are the protractor docs for the isPresent
function.
So, your code would be something like:
var myElement = element(by.css('.elementClass'));
expect(myElement.isPresent()).toBeFalsy();