I saw other protractor related post mentioning about how to wait for an element to become visible. However, recently, I ran into an opposite use case. I wanted to wait for an element until it becomes invisible. Since I could not find anything specific about it. I went ahead and came up with a solution.
var ptor = protractor.getInstance(); ptor.wait(function() { return element(by.css('#my-css-here')).isDisplayed().then(function(isVisible){ console.log('is visible :' + isVisible); return !isVisible; }); }, 12000).then(function(){ //do whatever you want });
hopefully it helps. any suggestion is welcome.
Thanks,
Using the elementexplorer (https://github.com/angular/protractor/blob/master/docs/debugging.md) I looked at the protractor object and found an answer that is working wonderfully for me:
var el = element(by.id('visibleElementId')); browser.driver.wait(protractor.until.elementIsNotVisible(el));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With