I've been trying this, and hit a wall.
What I want to do is to wait until the URL changes.
So the pseudo-code would look something like this:
var currentUrl = browser.getCurrentUrl();
browser.wait(function () {
var newUrl = browser.getCurrentUrl();
return (newUrl !== currentUrl);
});
// then continue doing stuff
However, I'm not sure how to use browser.getCurrentUrl() (which returns a promise) within browser.wait().
Here's my first go, but as I expected, it didn't work (the browser timed out) :
var currentUrl;
browser.getCurrentUrl().then(function (url) {
currentUrl = url;
}).then(function () {
return browser.wait(function () {
return browser.getCurrentUrl().then(function (url) {
return url !== currentUrl;
});
});
});
I've looked at the object returned by browser.getCurrentUrl(), and it doesn't have any methods that allow comparison with another value.
Any suggestions? I'm still getting to grips with the new frontier of JS Promises...
cheers
Matt