错误超时等待量角器在 11 秒后与页面同步 [英] Error Timed out waiting for Protractor to synchronize with the page after 11 seconds

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

问题描述

我的量角器测试有问题.我的 Angular 应用程序使用 $timeout 不断从服务器轮询某些内容.不幸的是,当我运行测试时,这会导致以下错误消息:

I have a problem with my Protractor tests. My angular app uses $timeout to continuously poll something from a server. Unfortunately this lead to the following error message when I'm running my tests:

 There was a webdriver error: Error Timed out waiting for Protractor to synchronize with the page after 11 seconds. Please see https://github.com/angular/protrac
tor/blob/master/docs/faq.md

如何处理这种连续轮询超时?在我的情况下,将 browser.ignoreSynchronization 设置为 false 不是一个好的解决方案(当我这样做时,我必须插入很多 browser.sleep())

How can I handle such continuously polling timeouts? Setting the browser.ignoreSynchronization to false is not a good solution in my case (when I do that I have to insert a lot of browser.sleep())

按照建议从 $timeout 切换到 $interval 这里目前在我的应用程序中是不可能的.增加超时也是不可能的(正如我所说的服务不断从服务器轮询某些东西)

Switching from $timeout to $interval as suggested here is currently not possible in my application. Increasing the timeout is also not possible (as I said the service is continuously polling something from the server)

是否有可能更改 waitForAngular 例程以使我的测试不会超时?

Is there a possibility to change the waitForAngular routine so that my test won't timeout?

任何帮助将不胜感激.

推荐答案

来自 protractor 的文档:

在执行任何操作之前,Protractor 会要求 Angular 等到页面已同步.这意味着所有超时和 http请求完成.如果您的应用程序不断轮询 $timeout或 $http,它永远不会被注册为完全加载.你应该对任何轮询使用 $interval 服务 (interval.js)连续(在 Angular 1.2rc3 中引入).

Before performing any action, Protractor asks Angular to wait until the page is synchronized. This means that all timeouts and http requests are finished. If your application continuously polls $timeout or $http, it will never be registered as completely loaded. You should use the $interval service (interval.js) for anything that polls continuously (introduced in Angular 1.2rc3).

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

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