DEV Community

Cover image for WebdriverIO Automation Protocol State of Confusion
tswiftma
tswiftma

Posted on

WebdriverIO Automation Protocol State of Confusion

I'm still somewhat of a WebdriverIO noob and I learned an important lesson this week. WebdriverIO supports two different automation protocols, Webdriver and Devtools and they can behave differently! Here's a link to the WebdriverIO doc for more details.

1) Using Webdriver. Webdriver is the older Selenium protocol and uses a middle man browser specific driver to drive the browser. It's very good for cross browser testing support.

How to use it in WebdriverIO: If you specify to use a service that updates browser drivers in your wdio.conf.js file you are most likely using Webdriver. For example:

  // Test runner services
  // Services take over a specific job you don't want to take care of. They enhance
  // your test setup with almost no effort. Unlike plugins, they don't add new
  // commands. Instead, they hook themselves up into the test process.

  services: ['chromedriver', 'edgedriver'],

Enter fullscreen mode Exit fullscreen mode

These services are all added via NPM packages. 'Selenium-Standalone' is another driver service.

2) Using Devtools: Devtools was developed with Chrome as an API to drive a browser directly without a specific driver. It also uses Puppeteer to drive the browser.

How to use it in WebdriverIO: If you don't specify to use a service in wdio.conf.js than you will default to using Devtools. Yes this confused the heck out of me because I was using the chromedriver service (aka Webdriver) for running Chrome and just specifying 'MicrosoftEdge' for a browser Capability which defaulted to using Devtools. If you look at the runtime logs you can see what WebdriverIO is using:

image

So what protocol do you want to use? Well I found out that Devtools doesn't support all WebdriverIO commands including browser.maximizeWindow( ). To keep the peace on my automation team I used Webdriver for all browsers. Also Devtools might not have the best cross browser support. But it does seem to be the future of browser automation and supports some pretty advanced dev features including network inspection so it might be worth a revisit in the future now that I'm less confused :)

Oldest comments (0)