WebdriverIO, IE11 window launches but errors in terminal: Request failed due to no such window, Currently focused window has been closed

Viewed 584

I am pretty new to WDIO and javascript, but am trying to get WebdriverIO v6 working with IE11. This is important since we make software for the medical industry who only seem to use IE11 despite it being an absolute pain!

So when I run the test, the IE11 window is opened, it navigates to the url I specified, then the window remains open and in view whilst nothing more happens, whilst the terminal starts to error repeating:

webdriver: Request failed with status 404 due to no such window: Currently focused window has been closed.

I then need to close IE11 manually. On Chrome the tests all run fine. I am not really sure what to do here and googling hasn't resulted in anything. Thankyou

Image showing console errors

My wdio.conf.js file is:

var baseUrl;
var input = process.env.SERVER;

if (input == 'x') {
    baseUrl = 'x-foo.com';
} else {
    baseUrl = 'y-foo.com';
};

var timeout = process.env.DEBUG ? 9999999 : 15000;
exports.config = {

    runner: 'local',

    specs: [
        './features/**/*.feature'
    ],
    // Patterns to exclude.
    exclude: [
        // 'path/to/excluded/files'
    ],

    maxInstances: 5,

    capabilities: [
        // {
        //     browserName: 'chrome',
        //     maxInstances: 1,
        // },
        {
            browserName: 'internet explorer',

            maxInstances: 1,
            timeouts: { "implicit": 5000 },
        }
    ],
    logLevel: 'error',
    bail: 0,
    baseUrl: baseUrl,
    waitforTimeout: 10000,
    connectionRetryTimeout: 120000,
    connectionRetryCount: 3,
    services: ['selenium-standalone', 'iedriver'],
    framework: 'cucumber',
    reporters: ['spec'],


    //
    // If you are using Cucumber you need to specify the location of your step definitions.
    cucumberOpts: {
        // <string[]> (file/dir) require files before executing features
        require: ['./step_definitions/*.js'],
        // <boolean> show full backtrace for errors
        backtrace: false,
        // <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
        requireModule: ['@babel/register'],
        // <boolean> invoke formatters without executing steps
        dryRun: false,
        // <boolean> abort the run on first failure
        failFast: false,
        // <string[]> (type[:path]) specify the output format, optionally supply PATH to redirect formatter output (repeatable)
        format: ['pretty'],
        // <boolean> hide step definition snippets for pending steps
        snippets: true,
        // <boolean> hide source uris
        source: true,
        // <string[]> (name) specify the profile to use
        profile: [],
        // <boolean> fail if there are any undefined or pending steps
        strict: false,
        // <string> (expression) only execute the features or scenarios with tags matching the expression
        tagExpression: 'not @Pending',
        // <number> timeout for step definitions
        timeout: 60000,
        // <boolean> Enable this config to treat undefined definitions as warnings.
        ignoreUndefinedDefinitions: false
    },


    before: function (capabilities, specs) {
        require('expect-webdriverio') //based on Jasmine & Jest
    },

    afterStep: function ({ uri, feature, step }, context, { error, result, duration, passed, retries }) {
        // if (error) {
        //     const path =  './errorShots/'+Date.now()+ step +'.png';
        //     browser.saveScreenshot(path);
        // }
    },


    after: async function (result, capabilities, specs) {
        await browser.pause(1000);
    },

    afterSession: async function (config, capabilities, specs) {
        await browser.pause(1000);
    },

}
1 Answers

I managed to fix it by enabling Protected Mode from Internet options(from Tools menu on the IE browser).

Related