下面是我使用expect(element(by.id('title')).getAttribute('value')).toMatch('Sample Title')的代码
在本地机器上,它工作得很好,而在服务器上,它没有出现以下错误。
Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular
While waiting for element with locator - Locator: By(css selector, *[id="title"])令人惊讶的是,当我单独执行这些测试时,它们有时会在服务器上运行。
来补充这个问题。我观察到量角器在测试中只能找到一个元素,其余的元素都被忽略,错误如上所述。
这个问题的解决方案是什么?
发布于 2018-01-05 22:03:29
这可能是应用程序的问题。有时,angular从不向量角器报告所有任务都已完成,因此您可能会收到此超时错误。
http://www.protractortest.org/#/timeouts
AngularJS如果AngularJS应用程序连续轮询$timeout或$http,则量角器将无限期等待并超时。您应该对连续轮询的任何内容使用$interval (在Angular 1.2rc3中引入)。
例如:
this.ngZone.runOutsideAngular(() => { setTimeout(() ) => { //此处的更改不会传播到您的视图中。this.ngZone.run(() => { //在ngZone内部运行以触发更改检测。});},REALLY_LONG_DELAY);});作为这两个选项的替代,您可以禁用等待Angular,如下所示。
发布于 2018-03-01 22:21:23
正如错误中所说,您的应用程序似乎不是一个角度。难到不是么?
如果是这样,您需要使用它:
browser.waitForAngularEnabled(false);https://stackoverflow.com/questions/48114389
复制相似问题