I have been trying to use the code snippet below to check if the element I'm looking for exists, however all I get is "Failed: No element found using locator: By(css selector, .icon-cancel)". What I want the program to do is to execute b()
element(by.css('.icon-cancel')).isDisplayed().then(function(result) {
if ( result ) {
a();
} else {
b();
}
});