超时过期等待 IE 9 上的异步脚本 [英] Timeout expired waiting for async script on IE 9

查看:44
本文介绍了超时过期等待 IE 9 上的异步脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Internet Explorer 9 上运行一些测试(使用 Protractor) - 每个包含driver.executeScript"的测试都会给出一个错误:等待异步脚本超时超时(警告:服务器没有提供任何堆栈跟踪信息).其他测试效果很好.

I'm trying to run some tests (using Protractor) on Internet Explorer 9 - and each test that contains " driver.executeScript " gives an error : Timeout expired waiting for async script (WARNING: The server did not provide any stacktrace information). The other tests work very well.

似乎 IE 不理解我在函数末尾添加的超时限制(20000 毫秒) - 约 11 秒后超时到期.

It seems that IE doesn't understand the timeout limit that I add at the end of function (20000 ms) - Timeout expires after ~11 seconds.

是否有任何 WebdriverJS 代码行使其等待异步执行?

Is there any WebdriverJS code line to make it wait for async execution?

所有测试在 Firefox 上都能完美运行.

All tests work perfectly on 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);

推荐答案

这里有两个超时 - 单个测试的超时,以及 WebDriver 在浏览器中运行的每个脚本的超时.查看 https://github.com/angular/protractor/blob/master/docs/debugging.md#timeouts 了解更多信息.

There are two timeouts in play here - the timeout for the individual test, and the timeout for each script that WebDriver runs in your browser. Check out https://github.com/angular/protractor/blob/master/docs/debugging.md#timeouts for more info on that.

您可以在配置中使用 allScriptsTimeout 设置脚本超时.请参阅 https://github.com/angular/protractor/commit/e34a4abf9973e62a2a6e9973e624ad15e95e>引入了该选项.

You can set the script timeout in the config with allScriptsTimeout. See https://github.com/angular/protractor/commit/e34a4abf9957d2aa73e0d8cda262e624ad15e95e for the CL which introduced that option.

这篇关于超时过期等待 IE 9 上的异步脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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