Upgrading WebdriverJs to Selenium 3

Yes, I know that Selenium 3 has been out for a while, but I’ve finally got around at looking at updating our end-to-end tests to use it. Newer versions of Firefox require Geckodriver which require Selenium 3.3+ so it’s a forced upgrade of sorts.

The main thing that affects us is the deprecation of the isElementPresent method on driver.

So this no longer works:

return this.driver.isElementPresent( this.quoteSelector );

You need to be a bit more verbose now to check the same thing:

return this.driver.findElements( this.quoteSelector ).then( e => !!e.length );

I’ll most likely write a helper method that achieves the same thing as isElementPresent did; I’m not sure why it was removed in the first place.

And after upgrading I tried running against Firefox only to see:

 WebDriverError: Unable to parse new session response

It turns out that WebDriverJs 3.3.0 doesn’t support Geckodriver after all 😕

I miss the good old days where Selenium could just drive Firefox without extra dependencies.

Author: Alister Scott

Alister is a Software Quality Engineer for Automattic.

5 thoughts on “Upgrading WebdriverJs to Selenium 3”

    1. Thanks, I tried getting Geckodriver 0.14.0 via brew but it seems really tricky to install an old version which isn’t already local. So I’ll just wait for WebDriverJs 3.3.1…

Comments are closed.