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

On Thursday, 13 March 2014 14:03:14 UTC, Matt Calthrop wrote:
>
> Thanks Demetrius... I had stumbled upon that function, and was going to 
> give it a go.
>
> cheers!
>
> Matt
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to