am trying to check element on regular interval and click only if it is present. Some times this element appears in 2-3 minutes. If it is not present, i want to wait for few seconds and then refresh page
Here is what i tried:
for(var i = 1; i < 60; i++){
element(that.proposalByOrderPath(num)).isPresent().then(function(result){
if(result){
console.log(i);
return element(that.proposalByOrderPath(num)).click();
}
else{
browser.sleep(15000);
browser.refresh();
}
});
}
As an output, it prints 60 twice. It clicks on the element once but tries to look again for the element and throws "element not visible" error.