Reputation: 21
I'm trying to retrieve the isolated scope on a directive in protractor using the following code:
protractor.executeAsyncScript(function(callback){
var isolatedScope = angular.element("div[my-directive='data']").isolateScope();
callback(isolatedScope);
}).then(function(isolatedScope){
console.log("directive's isolatedScope:", isolatedScope);
});
Unfortunatley I'm getting the following error from Chrome:
UnknownError: Unknown error: Maximum call stack size exceeded (Session info: chrome=34.0.1847.131)
Upvotes: 0
Views: 1957
Reputation: 8958
One of the reasons Maximum call stack size exceeded
error occurs is when a function calls itself. For example
let next = async function () {
await $nextButton.click();
await next();
}
What happens here is the code gets in an infinite loop and throws the error
Thus just go over your code and make sure you don't do it somewhere by accident
Upvotes: 0
Reputation: 19840
You should not send back objects which are too big/complex from the client to protractor. In your case, isolatedScope
is too big.
This can happen with executeAsyncScript()
, executeScript()
and evaluate()
(which use executeScript()
).
If you are troubleshooting a problem, can you reproduce it outside of protractor ? Then it's very easy to observe the scope : right click "inspect element", then in dev console, type $scope
If you are trying to inspect the scope for tests reasons, then you are not testing at the right place. Protractor tests are high level "black box" tests. You anly care about user perspective, ex. "is the button visible ?". The user will never interact with the scope, nor should you. For testing a directive internal state, use DOM client unit tests.
Upvotes: 4