protractor: Cannot read property '$$testability' of undefined
In Protractor 5.1.1 if your Angular app has a root element other than <body>
, you’ll see the error Cannot read property '$$testability' of undefined
. This is because browser.angularAppRoot() is expected to return the current value of app root if a value isn’t passed to it, but currently returns undefined.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 42 (10 by maintainers)
Commits related to this issue
- fix(browser): Fix browser.angularAppRoot() By default, it wasn't returning anything. Now it returns a promise that resolves to internalAngularAppRoot. Fixes #4233 — committed to heathkit/protractor by heathkit 7 years ago
- fix(browser): Fix browser.angularAppRoot() By default, it wasn't returning anything. Now it returns a promise that resolves to internalAngularAppRoot. Fixes #4233 — committed to angular/protractor by heathkit 7 years ago
Hi Contributors,
Any updates around this issue . Using protractor version 5.1.2 doesn’t resolve this issue. I have test cases suite that run one after the other and it’s quite sporadic… sometimes it works and sometimes they fail because of this issue. So, if you try to run say ~ 30 cases together , you will still get this issue using 5.1.2.
Thank you for your help.
We’re planning to do a 5.1.2 tomorrow that should include this fix.
I had to add the following code to get rid of
then had to increase browser.sleep
browser.sleep(5000);
in order to fix
So it seems like Angular isn’t initialised properly yet
If anyone is still seeing this issue in 5.1.2, could you please reopen with an example that reproduces the problem? Thanks.
@avinashs15 You can build from source by following these directions. After you run
npm install
you’ll have a binary atbin/protractor
that will work with non-body-tag-based AngularJS apps.Hi - Is this still an issue for some people?
If you are having issues with Protractor and your hybrid app, can you post the following from Chrome devtools console for your app?
Those who have responded since this issue has been resolved have either:
rootElement
defined asbody
, in which case you have a different problem.rootElement
undefined, meaning it is defaulting tobody
, in which case you have a different problem.This issue was specifically related to
$$testability
beingundefined
when therootElement
is not the<body>
tag, which has been fixed. It is likely you have a different configuration issue.