protractor: Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
After updated Protaractor to 1.6.1 , webdriver , chromedriver, jasmine to 2.0, when i try to run my tests i got:
"Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
Start test TC06_01_01_Binary_1_1
Started
Execute test TC06_01_01_Binary_1_1
Login as Admin
Execute script no 18
F
Failures:
1) TC06_01_01_Binary_1_1 TC06_01_01_Binary_1_1 Should be able to add record with different values
Message:
Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
Stack:
Error: Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:104:1
6
at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\go
og\base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\E2Euser\AppData\Roaming\npm\
node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
at notify (C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdrive
r\lib\webdriver\promise.js:465:12)
Message:
Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the windo
w"
Stack:
Error: Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on th
e window"
at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:104:1
6
at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\go
og\base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\E2Euser\AppData\Roaming\npm\
node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
at notify (C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdrive
r\lib\webdriver\promise.js:465:12)
Message:
Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the windo
w"
Stack:
Error: Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on th
e window"
at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:104:1
6
at C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\go
og\base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (C:\Users\E2Euser\AppData\Roaming\npm\
node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1654:20)
at notify (C:\Users\E2Euser\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdrive
r\lib\webdriver\promise.js:465:12)
1 spec, 1 failure
Finished in 1.409 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1"
any idea why Angular cannot be found? or how should i fix this?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 52 (3 by maintainers)
Commits related to this issue
- Downgrade to protractor 1.8.0 https://github.com/angular/protractor/issues/1760 — committed to Dineshs91/devlog by Dineshs91 9 years ago
- Downgrade protractor to 1.8.0 https://github.com/angular/protractor/issues/1760 issue exists in 2.0.0 and above — committed to Dineshs91/devlog by Dineshs91 9 years ago
- Downgrade protractor to 1.8.0 https://github.com/angular/protractor/issues/1760 issue exists in 2.0.0 and above — committed to Dineshs91/devlog by Dineshs91 9 years ago
I was seeing the same error with Angular 5 testing. Maybe this is stating the obvious but I didn’t know you needed to start “ng serve” separately before running your e2e tests if you want to debug. Here is the discussion where I found the answer: https://github.com/angular/angular-cli/issues/4183
Hope this helps someone!
I see above that you have
return /thetestroom/.test(url);
in the code above. That was an example I gave for someone else for their url in an older response. Please change ‘thetestroom’ here to whatever your url will look like. You should have gotten wait time out here instead of angular issue. Here is the code I have to solve this issueinstead of waiting for url to change, wait for the emailAddress element to be present as well. Also try browser.driver.wait and browser.driver.getCurrentUrl. Move all the other test code inside the get()…{} block as well.
@reddynr I do not see you wait for an element or anything after you .get() the page. You should. See examples above in this thread
In your case it should be
browser.get(..).then(function() { browser.driver.wait(browser.driver.isElementPresent(by.model('ctrl.formData.emailAddress'))); // all remaining sendKeys, submit and assert code here. });
I do not see you waiting for Angular or wait for any specific url change in browser or an element before you get the title. See if this helps.
browser.get(testUrl).then(function() { browser.wait(function() { return browser.getCurrentUrl().then(function(url) { return /thetestroom/.test(url); }); }, 10000); });