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 an Excellence Wrangler for Automattic.

5 thoughts on “Upgrading WebdriverJs to Selenium 3”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s