WebDriverIO tests fails inconsistently with a socket error, now what?

WebDriverIO tests fails inconsistently with a socket error, now what?

Once in while my WebDriverIO test failed with a Java socket error, not everytime but it was still pretty enjoying! Especially when your test has to run in a CI/CD environment. One flakky test and the enitre credibilty of your test suite is at stake. I love WebDriverIO but I needed a fix.

Unfortuantly the error didn’t help me much

java.net.SocketException: Connection reset by peer
  Error: An unknown server-side error occurred while processing the command.
      at elementIdDisplayed("0.14703088915361828-3") - isVisible.js:71:55

So after roaming around on the interwebs I found this issue:

Selenium issue 5611

Good news, other people are having this issue. Bad news, at the time of writing this post the issue hasn’t been resolved. So I needed a work around.

After some more digging I found a 2 part solution

First downgrade to a Selenium Standalone version which doesn’t have the issue. This can be acchieved by setting the standalone version to 3.4 in the config file

exports.config = {
// see: https://github.com/webdriverio/webdriverio/issues/2262
seleniumInstallArgs: { version: '3.4.0' },
seleniumArgs: { version: '3.4.0' },
specs: [
'./test/features/*.feature',

This however is not enough. The previous, newer selenium version with the issue is still present in the node_modules folder. Now you can either delete all the folders using

rm -rf node_modules

or only the selenium folder just make sure you do a

npm install

after deletion and you are good to go!

Please follow and like us:

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *