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

Commit 76c094a

Browse files
penfoldjuliemr
authored andcommitted
feat(getLocationAbsUrl) - allows current url to be obtained on IE (and Chrome/Firefox)
1 parent 6a1c918 commit 76c094a

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/clientsidescripts.js

+10
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,13 @@ clientSideScripts.evaluate = function() {
342342

343343
return angular.element(element).scope().$eval(expression);
344344
};
345+
346+
/**
347+
* Return the current url using $location.absUrl().
348+
*
349+
* arguments[0] {string} The selector housing an ng-app
350+
*/
351+
clientSideScripts.getLocationAbsUrl = function() {
352+
var el = document.querySelector(arguments[0]);
353+
return angular.element(el).injector().get('$location').absUrl();
354+
};

lib/protractor.js

+8
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,14 @@ Protractor.prototype.get = function(destination, opt_timeout) {
539539
}, this.moduleNames_);
540540
};
541541

542+
/**
543+
* Returns the current absolute url from AngularJS.
544+
*/
545+
Protractor.prototype.getLocationAbsUrl = function() {
546+
this.waitForAngular();
547+
return this.driver.executeScript(clientSideScripts.getLocationAbsUrl, this.rootEl);
548+
};
549+
542550
/**
543551
* Pauses the test and injects some helper functions into the browser, so that
544552
* debugging may be done in the browser console.

0 commit comments

Comments
 (0)