0

I'd like to access scopes of Angular app module like this

var scopes = angular.element(document.querySelectorAll('[ng-app]')).scope();

but I can't figure out how we use it in Protractor. I tried:

1) var scopes = element(by.css(['ng-app'])).scope()
2) var scopes = angular.element(document.querySelectorAll('[ng-app]')).scope()

But all of these 2 options return "undefined is not function" or for 2nd option "angular is not defined"

Thanks in advance

Novitoll
  • 770
  • 7
  • 21

1 Answers1

0

Thanks to @alecxe. If I wrap the code mentioned above in

browser.executeAsyncScript

it will work

Novitoll
  • 770
  • 7
  • 21