DEV Community

tswiftma
tswiftma

Posted on • Updated on

WebdriverIO DevTools Edge driver options

I recently needed to add Microsoft Edge browser coverage to my Webdriver.IO tests. But when I added 'edge' (or 'MicrosoftEdge') as the browserName in the wdio.config.js capabilities, a couple of problems occurred:

1) browser.maximizeWindow( ) in my test project stopped working with the following error "Error: Command "maximizeWindow" is not yet implemented". It still works for chrome however. I found that quite a few people were hitting this problem but there really wasn't a solution available. I think that the problem lies with the actual MicrosoftEdge driver itself. So as a workaround I now always start the browsers in wdio.config.js with the args option '--start-maximized'. I also stopped using the call browser.maximizeWindow() altogether.

2) When the Edge browser came up it only used a defaultViewport of 1200x800 even if the browser was maximized. This was weird because my web app would only use part of the browser display. Looking at the WebdriverIO run logs showed that devtools:puppeteer was starting Edge with the option "defaultViewport":{"width":1200,"height":900}. I have no idea why it would default to this! The workaround was to set a 'wdio:devtoolsOptions' value for defaultViewport to null.

Below is the code to add to wdio.conf.js. Hope this is helpful in getting Microsoft Edge to run with WebdriverIO!

    capabilities: [
      // more capabilities defined here
      // or override capabilities from wdio.conf.js      
      {
        maxInstances: 1,
        browserName: 'edge',
        'ms:edgeOptions': {
          args: ['--start-maximized']
        },
        acceptInsecureCerts: true,
        //
        // Edge launches via devtools/puppeteer.
        // Need to set defaultViewport to null to use the whole browser
        'wdio:devtoolsOptions': {
          defaultViewport: null
        }
      }
    ],
Enter fullscreen mode Exit fullscreen mode

Discussion (0)