Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 等待量角器与页面同步11秒后出错超时_Angularjs_Selenium Webdriver_Timeout_Webdriver_Protractor - Fatal编程技术网

Angularjs 等待量角器与页面同步11秒后出错超时

Angularjs 等待量角器与页面同步11秒后出错超时,angularjs,selenium-webdriver,timeout,webdriver,protractor,Angularjs,Selenium Webdriver,Timeout,Webdriver,Protractor,我的量角器测试有问题。我的angular应用程序使用$timeout从服务器上连续轮询某些内容。不幸的是,在运行测试时,这会导致以下错误消息: 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/

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

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

在我的应用程序中,目前无法按建议从$timeout切换到$interval。增加超时时间也是不可能的(正如我所说的,服务正在不断地从服务器轮询某些内容)

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

我们将非常感谢您的帮助

来自:

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

和你一样的船

我们已经看到很多帖子讨论了
sleep()
waitForAngular()
browser.ignoreSynchronization

我同意您的看法,设置:
ignoreSynchronization=true
不是一个好主意,因为它迫使我们手动等待每个异步进程

一些人建议同时使用
sleep()
,然后使用
waitForAngular()
,如下所示:

browser.sleep(10000);
browser.waitForAngular();
我真的不明白为什么有时候
waitForAngular()
无法等待页面同步完成,而这段“双重等待”代码确实有效


请查看它是否适用于您的情况。

将allScriptsTimeout更改为大于11000000的值修复了我的问题

等待量角器时超时

在node_modules/dragrator/lib/configParser.js中,更改为:


allScriptsTimeout:25000

在量角器配置文件中添加allScriptsTimeout:50000

exports.config = {
    ...
    allScriptsTimeout: 50000,
    ...
};

或者至少这解决了我的问题

没有其他方法处理这个问题吗?您不应该更改模块内部的默认值。。。在您自己的配置文件中更改它。请参见下面的注释()。