我正在尝试在 Internet Explorer 9 上运行一些测试(使用 Protractor) - 每个包含“ driver.executeScript ”的测试都会给出错误:等待异步脚本超时(警告:服务器未提供任何堆栈跟踪信息)。其他测试效果很好。
看来 IE 不理解我在函数末尾添加的超时限制(20000 毫秒)- 超时在约 11 秒后到期。
是否有任何 WebdriverJS 代码行使其等待异步执行?
所有测试都在 Firefox 上完美运行。
code:
#### 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);
这里有两个超时 - 单个测试的超时,以及 WebDriver 在浏览器中运行的每个脚本的超时。查看https://github.com/angular/protractor/blob/master/docs/debugging.md#timeouts https://github.com/angular/protractor/blob/master/docs/debugging.md#timeouts了解更多信息。
您可以使用 allScriptsTimeout 在配置中设置脚本超时。看https://github.com/angular/protractor/commit/e34a4abf9957d2aa73e0d8cda262e624ad15e95e https://github.com/angular/protractor/commit/e34a4abf9957d2aa73e0d8cda262e624ad15e95e对于引入该选项的 CL。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)