Sticking with WebdriverIO Version 4

No, this is not a post about me choosing to stay on WebdriverIO version 4 over the newly released 5.x update.

Rather, it's a simple technical explanation of how to install and use version 4, instead of having to go with the default of 5.

Okay but why?

The main reason I'm interested in this is that I have a 50 video course on WebdriverIO, and within the first few lessons students will be hitting errors due to the version 5 release.

While I'd love to have re-recorded all 50 videos already, the time for that is sparse. So for the next few months I need my students to be able to install and use version 4 while they wait for the version 5 updated videos to be released.

But I'm also guessing that there are folks out there who have their reasons for using version 4. Something something legacy code.

How to do it

TL;DR run this command when to install version 4:

npm i webdriverio@4

This will install the most recent 4.x version, which is 4.14.1 as of this writing.

After that, when you run the config, it will install the V4 compliant versions of the services and reporters and you're off to the races. Run everything else as normal.

How does this work?

Normally, when you install a package using NPM, you use just the name of the module you want. This installs the version of the module tagged as latest on the npm registry (which is the most recent non-"pre-release" version).

But there's a lesser know way of installing packages, and that includes adding the specific version you want.

Using the @ symbol, we can get more specific about what we want installed. If we pass in a valid number that matches a published version in the NPM registry, it will use that version.

It's also smart enough to take a best guess at what you want if you're not overly specific with the number. So by just sending 4, NPM will install the most recent 4.x.x version.

There are plenty of details about npm install over on their documentation site, so check it out if you're interested.

What about the WebdriverIO docs

The good folks at WebdriverIO have you covered. After the switch, they put up a legacy version of the WebdriverIO website, which includes all the old version 4 documentation.

Check it out (and bookmark it as if that were still a thing) at

Header Photo by Paul Bergmeir on Unsplash