我试图在Internet 9上运行一些测试(使用Protractor) --每个包含“driver.executeScript”的测试都会出现一个错误:超时等待异步脚本(警告:服务器没有提供任何堆栈跟踪信息)。其他的测试效果很好。
似乎IE不理解我在函数末尾添加的超时限制(20000 ms) --超时在大约11秒后到期。
是否有任何WebdriverJS代码行让它等待异步执行?
在Firefox上,所有的测试都是完美的。
代码:
#### this one works ####
it("should display selected Date Filter", function() {
ptor.get("data-entry?readingType=no readings after");
var sel = ptor.findElement(protractor.By.selectedOption('data.dateFilterType'));
expect(sel.getText()).toEqual('No readings after date');
}, 20000);
#### this one doesn't work ####
it("should display Selected Locations", function() {
ptor.get("data-entry?locationIds=254,216");
ptor.waitForAngular();
ptor.driver.executeScript("$('#locations').show();");
ptor.sleep(10000);
ptor.findElements(protractor.By.selectedOption('data.locationIds')).then( function(arr) {
expect(arr[0].getText()).toBe('Bovendijk');
expect(arr[1].getText()).toBe('Centrum Locatie');
});
}, 20000);发布于 2013-10-16 18:43:02
这里有两个超时:单个测试的超时和WebDriver在浏览器中运行的每个脚本的超时。有关这方面的更多信息,请访问https://github.com/angular/protractor/blob/master/docs/debugging.md#timeouts。
您可以使用allScriptsTimeout在配置中设置脚本超时。有关引入该选项的CL,请参见https://github.com/angular/protractor/commit/e34a4abf9957d2aa73e0d8cda262e624ad15e95e。
https://stackoverflow.com/questions/19380444
复制相似问题