Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
feat(getLocationAbsUrl) - allows current url to be obtained on IE (an…
Browse files Browse the repository at this point in the history
…d Chrome/Firefox)
  • Loading branch information
penfold authored and juliemr committed Nov 21, 2013
1 parent 6a1c918 commit 76c094a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/clientsidescripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,13 @@ clientSideScripts.evaluate = function() {

return angular.element(element).scope().$eval(expression);
};

/**
* Return the current url using $location.absUrl().
*
* arguments[0] {string} The selector housing an ng-app
*/
clientSideScripts.getLocationAbsUrl = function() {
var el = document.querySelector(arguments[0]);
return angular.element(el).injector().get('$location').absUrl();
};
8 changes: 8 additions & 0 deletions lib/protractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,14 @@ Protractor.prototype.get = function(destination, opt_timeout) {
}, this.moduleNames_);
};

/**
* Returns the current absolute url from AngularJS.
*/
Protractor.prototype.getLocationAbsUrl = function() {
this.waitForAngular();
return this.driver.executeScript(clientSideScripts.getLocationAbsUrl, this.rootEl);
};

/**
* Pauses the test and injects some helper functions into the browser, so that
* debugging may be done in the browser console.
Expand Down

0 comments on commit 76c094a

Please sign in to comment.