protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"

Open softacid opened this issue 11 years ago • 52 comments

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?

softacid avatar Jan 28 '15 12:01 softacid

I've actually had this exact same issue on OSX.

... snip ...
Running "connect:test" (connect) task
Started connect web server on http://localhost:9001

Running "protractor:run" (protractor) task
Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Uncaught exception: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
[launcher] Process exited with error code 1
>>
Fatal error: protractor exited with code: 1
... snip ...

After this, the instance of Chrome it had opened up remains open in a hung state.

yonkeltron avatar Feb 17 '15 20:02 yonkeltron

I have the same problem today on Mac OS. After closed all terminals and browsers and reopen this error stop ( sor far at least ).

thiagomata avatar Feb 25 '15 00:02 thiagomata

I am experiencing this as well with version 2.0.0.

whroman avatar Apr 01 '15 05:04 whroman

even i'm facing the same issue.

On Wed, Apr 1, 2015 at 11:03 AM, Walter H. Roman [email protected] wrote:

I am experiencing this as well with version 2.0.0.

— Reply to this email directly or view it on GitHub https://github.com/angular/protractor/issues/1760#issuecomment-88355894.

LeninChristopher avatar Apr 01 '15 05:04 LeninChristopher

me too

andreyselitsky avatar Apr 01 '15 10:04 andreyselitsky

same here, why is this issue closed?

cm325 avatar Apr 07 '15 02:04 cm325

downgrading to 1.8.0 fixed this issue-

cm325 avatar Apr 07 '15 03:04 cm325

Do you call browser.get() inside your onPrepare function? See #1978

glepretre avatar Apr 07 '15 07:04 glepretre

I'm using browser.get(), but i don't think I'm using onPrepare, I'm running this example for angular todomvc - https://github.com/mknabe/angular-testing-starter/blob/master/test/e2e/scenarios.js

cm325 avatar Apr 07 '15 14:04 cm325

bump...

like @cm325 I am getting the "angular could not be found on the window" error when running 2.0.0 but downgrading to 1.8.0 fixes the issue

dremonkey avatar Apr 14 '15 23:04 dremonkey

BUMP!

same issue after upgrading to v2.1.0, had to downgrade to 1.8.0 to fix the issue

JesusLopezCh avatar Jun 08 '15 22:06 JesusLopezCh

Having this same problem also on OSX

Edited - Fixed

So I fixed this by changing the following code in one of my Page Constructors:

this.currentUrl =  browser.getCurrentUrl();

To

this.currentUrl = function(){
    return browser.getCurrentUrl();
  };

badisa avatar Jun 09 '15 15:06 badisa

My tests were running fine and for no reason this showed up. I made no changes to the system or code to cause this. I cannot downgrade, I need 2.0. I did the last workaround for currentUrl and that does not help either. ANy help will be awesome..

srajagopalan1712 avatar Jul 10 '15 22:07 srajagopalan1712

I'm experienced the same at Monday. Last Friday everything was fine, then from Monday I cannot run any test because when the login page needs to be loaded, which is a non-Angular page, I get the same error. Tried to downgrade protractor to 1.8.0 and 1.4.0, nothing, tried to change the framework to 'jasmine2', again nothing, I'm not using browser.get in onPrepare. I haven't got more idea what can I try. Any other suggestions, what can I change or try? Thx!

Yok86 avatar Jul 28 '15 14:07 Yok86

I'm experiencing the same problem here too. :fist:bump for more attention. Downgrading to 1.8.0 from 2.1.0 did not resolve it immediately...

cvharris avatar Aug 04 '15 18:08 cvharris

I have the same problem. I just set up protractor with cucumber-js, chai and chai-as-promised. I have two very basic features testing against basic sample steps. I'm also using ES6 pre-transpiled and loaded with SystemJS. I can't find out how to consistently reproduce this problem. Although right now I can do it my changing one of my specific steps to intentionally fail. Not sure if it's being executed first/last or why it has to be that specific one.

Both step wrappers basically look like this:

var Promise = require('es6-promise').Promise;
var World = require("../support/world.js").World;

module.exports = function() {
    this.World = World;

    this.Given(/^Something exists$/, function() {
        browser.get('http://localhost:3000/');
        return Promise.all([
            expect(browser.getCurrentUrl()).to.eventually.equal('http://localhost:3000/#/dashboard'),
            expect(browser.getTitle()).to.eventually.equal('Dashboard')
        ]);
    });
};

mikekhaas avatar Aug 07 '15 15:08 mikekhaas

Hi guys! We solved the problem in our project. But unfortunately I don't know exactly that the problem was with the protractor and jasmine-reporters versions or with something else. In some point in the test we wrote

element(by.id('logIn')).click().then(function (p) {
                browser.driver.wait(browser.driver.isElementPresent(by.id('Email')));
            });;

and some more like that, and these waits are solved the problem. I know it's not the best to solve like this, but it is working for now and that was the first point, to make it working.

Yok86 avatar Aug 07 '15 15:08 Yok86

@Yok86 Just tried your fix and it worked! :+1:

This is tidier than our workaround too. We threw a browser.debugger() at the end of our onPrepare handler and that seemed to fix the timing issue at play, but I have no idea why. This is much cleaner.

browser.driver.findElement(by.xpath("//*[@id='submit']")).click().then(function(p) {
      browser.driver.wait(browser.driver.getTitle().then(function (title) {
        return title == 'AppName';
      }));
    });

cvharris avatar Aug 10 '15 13:08 cvharris

Have the same issues:

Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.4.5/ng/test" Stack: Error: Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.4.5/ng/test" at stack (c:\Program Files\nodejs\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1482:17) at buildExpectationResult (c:\Program Files\nodejs\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1452:14) at Spec.Env.expectationResultFactory (c:\Program Files\nodejs\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:583:18) at Spec.addExpectationResult (c:\Program Files\nodejs\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:324:34) at Suite.addExpectationResult (c:\Program Files\nodejs\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:2123:38) at Env.fail (c:\Program Files\nodejs\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:894:25) at Function.next.fail (c:\Program Files\nodejs\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1806:19) at c:\Program Files\nodejs\node_modules\protractor\node_modules\jasminewd2\index.js:101:16 at [object Object].promise.ControlFlow.runInFrame_ (c:\Program Files\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:1877:20) at [object Object].promise.Callback_.goog.defineClass.notify (c:\Program Files\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:2464:25) at [object Object].promise.Promise.notify_ (c:\Program Files\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:563:12) at Array.forEach (native) at Object.goog.array.forEach (c:\Program Files\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\array\array.js:203:43) at [object Object].promise.Promise.notifyAll_ (c:\Program Files\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\promise.js:552:16) at goog.async.run.processWorkQueue (c:\Program Files\nodejs\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21) at process._tickCallback (node.js:356:9)

Karpo72 avatar Sep 29 '15 14:09 Karpo72

Same error here on OSX, when running wiht phantomjs. Works fine in Chrome

Error while waiting for Protractor to sync with the page: "[ng:test] http://errors.angularjs.org/1.4.3/ng/test"

andreasmaier avatar Oct 02 '15 21:10 andreasmaier