Reputation: 69735
I would like to get the current URL using protractor, and then verify that this URL is the one that I need. I am using:
istheSameURL(url) {
return browser.getCurrentUrl() === 'http://localhost:9000/#/analysis/62/1';
}
However, it is not working.
Upvotes: 0
Views: 1321
Reputation: 921
browser.getCurrentUrl() doesn't work with IE 10 if I recall. If you want to test against IE, you'll have to write some jquery that does that. I combined both the browser.getCurrentUrl method and the jquery into a function, did an if-check on the browser, and then put that in a common function library.
Upvotes: 1
Reputation: 473833
Yes, browser.getCurrentUrl()
should be used. It could be that you need to wait for the URL to be changed using browser.wait()
:
var urlChanged = function(url) {
return function () {
return browser.getCurrentUrl().then(function(actualUrl) {
return url != actualUrl;
});
};
};
browser.wait(urlChanged("http://localhost:9000/#/analysis/62/1"), 5000);
Upvotes: 1