Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
798 views
in Technique[技术] by (71.8m points)

angularjs - Timed out waiting for Protractor to synchronize with the page after 50001ms

I am testing AngularJS app and very new to protractor. Every time I open the browser, it gets opened and then waits for the timeout before throwing the following error on cmd.

Timed out waiting for Protractor to synchronize with the page after 50001ms

I have tried increasing the timeout limit, but always get this error. I have also tried using all of these:

        browser.ignoreSynchronization = true;
        browser.driver.sleep(5000);
        browser.debugger();
        browser.waitForAngular();

The page loads properly and if I use Eclipse and Selenium to interact with button objects, it just works fine.

Only protractor is having Sync issues. Please Help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Possible reasons why Protractor would time out:

  1. Your web page doesn't implement Angular in an expected way (i.e. with an ng-app on the body tag). More often, the error you will get in this case is Angular not found on page, but a timeout isn't out of the question. Using ignoreSynchronization would fix this if it were the issue, so this one isn't you.
  2. An HTTP request is pending or fails. Open up your dev console and check the "Network" tab when the page loads with Protractor (it may happen with Protractor and not in a manual test). If you find something failing, make sure you are issuing the request correctly. For example, if you're trying to access an HTTP endpoint through HTTPS, it's definitely possible that the request would fail and Protractor would time out.
  3. Your page is polling $timeout or $http repeatedly. Protractor won't do anything until Angular has reached a "resting" state (all elements and data bindings are loaded and all requests have returned).

The official list of timeout reasons is here: https://github.com/angular/protractor/blob/master/docs/timeouts.md.

But if you check the Javascript console and Network requests as the page loads, you should be able to figure out what's wrong. Good luck!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...