Timeout expired waiting for async script on IE 9

雨燕双飞 提交于 2020-02-24 05:49:08

问题


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.

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.

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

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

回答1:


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.

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.



来源:https://stackoverflow.com/questions/19380444/timeout-expired-waiting-for-async-script-on-ie-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!