50001ms 后等待 Protractor 与页面同步超时 [英] Timed out waiting for Protractor to synchronize with the page after 50001ms

查看:17
本文介绍了50001ms 后等待 Protractor 与页面同步超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试 AngularJS 应用程序,并且对量角器非常陌生.每次我打开浏览器时,它都会打开,然后等待超时,然后在 cmd 上抛出以下错误.

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.

50001ms后等待Protractor与页面同步超时

我尝试增加超时限制,但总是收到此错误.我也尝试过使用所有这些:

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();

页面加载正常,如果我使用 Eclipse 和 Selenium 与按钮对象交互,它就可以正常工作.

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.

推荐答案

Protractor 超时的可能原因:

Possible reasons why Protractor would time out:

  1. 您的网页没有以预期的方式实现 Angular(即在 body 标记上使用 ng-app).更常见的是,在这种情况下您会遇到的错误是 Angular not found on page, 但超时并非不可能.如果是问题,使用 ignoreSynchronization 会解决这个问题,所以这不是你.
  2. HTTP 请求正在等待处理或失败.当页面使用 Protractor 加载时,打开您的开发控制台并检查网络"选项卡(它可能发生在 Protractor 而不是手动测试中).如果您发现某些事情失败,请确保您正确地发出请求.例如,如果您尝试通过 HTTPS 访问 HTTP 端点,那么请求肯定会失败并且 Protractor 会超时.
  3. 您的页面正在反复轮询 $timeout$http.Protractor 不会做任何事情,直到 Angular 达到休息"状态(所有元素和数据绑定都已加载并且所有请求都已返回).
  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).

超时原因的官方列表在这里:https://github.com/angular/protractor/blob/master/docs/timeouts.md.

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

但是,如果您在页面加载时检查 Javascript 控制台和网络请求,您应该能够找出问题所在.祝你好运!

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!

这篇关于50001ms 后等待 Protractor 与页面同步超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆