Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timeout expired waiting for async script on IE 9

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);
like image 600
cristifilip Avatar asked Jan 31 '26 01:01

cristifilip


1 Answers

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.

like image 121
Jmr Avatar answered Feb 01 '26 15:02

Jmr