Skip to content

Instantly share code, notes, and snippets.

@F1LT3R
Last active October 15, 2015 16:15
Show Gist options
  • Save F1LT3R/8748333c3523daf0d6d8 to your computer and use it in GitHub Desktop.
Save F1LT3R/8748333c3523daf0d6d8 to your computer and use it in GitHub Desktop.
// Trying to get the controller's $scope
browser.executeScript(function () {
return angular.element(document.getElementById('app')).scope();
}).then(function($scope){
console.log($scope);
});
// Returns null for me even though my controller is running in #app element
@F1LT3R
Copy link
Author

F1LT3R commented Oct 15, 2015

// but its works for services
    browser.executeScript(function () {
      return angular.element(document).injector().get('API');
    }).then(function(API){
      console.log(API);
    });

@rbinsztock
Copy link

function getAngularVersion() {
return window.angular.version.full;
}

browser.executeScript(getAngularVersion).then(function (version) {
console.log(version);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment