I actually have issue with following code :
var promise = element(by.id("closeNotification")).isPresent(); // point A
console.log(promise);
promise.then((message) => {
element(by.id("closeNotification")).click();
browser.sleep(3000);
}, (errorMessage) => { // Point B
browser.refresh();
});
Here at point A, if element is present, program runs smoothly. But if element is not present, an error is thrown. At point B i have tried to handle the promise if it is rejected. Please help me with the condition if element is not present. Thanks in advance.