Is there a better way to wait until all page is loaded,
my angular pages are loaded with promise, it means that if all ajaxs call haven't ended yet there is a loader on the screen.
i'm currently using ptor.sleep(10000), like in the following example:
beforeEach(function(){
ptor = protractor.getInstance();
driver = ptor.driver;
ptor.get(base_url);
ptor.sleep(10000);
});
is there a better way to do it?
If you're using ng-if
to hide/show your content when loading starts/finishes, you can use the following syntax to wait until a certain element appears on the page (i.e. ng-if
will prevent the element from being in the DOM until the page finishes loading):
ptor.findElement(by.id('element-only-shown-after-loading')).then(function (myElement) {
// Your page should be loaded at this point
});
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