Reputation: 6963
Am able to get to the proper page no problem using browser.get()
. I then get.all(by.TagName('a'))
for the links and click on the first one, browser goes there no problem. This statement returns the promise with new URL...
browser.getCurrentUrl().then(function (url) { //I can see proper new page url here..}
I get a stale page error on the expect statement below... contained within the callback above is this:
describe('new page url', function(){
it('should do something', function(){
expect(url == "http://SomeValueAlreadyKnown");
}
});
Please advise me on what I'm doing wrong. How to click on links and avoid stale page errors?
Upvotes: 1
Views: 1088
Reputation: 473833
In protractor expect()
is "patched" to resolve promises implicitly, you can just do:
expect(browser.getCurrentUrl()).toEqual("http://SomeValueAlreadyKnown");
Upvotes: 1