I\'ve been developing automated tests in Protractor for quite some time and like many of you, I\'ve run into gaps which can only be crossed with the browser.sleep()
This is the way if you want to perform any action when element present or want to wait until it present on page.
element(by.id).isPresent().then(function(result) {
if (result) {
nextButton.click();
}
else{
browser.wait(function () {
return browser.isElementPresent(element(by.id));
},50000);
}
}).then(function () {
nextButton.click();
});
},