TesterHQ - The Evil Tester Blog Aggregator

Oct 20, 2016 - 5 minute read - Selenium Simplified Blog WebDriver

Q: Should you use Selenium 3? A: Probably. I have.

Original Blog Posting on [SeleniumSimplified.com]

TLDR; moving between Selenium 2.53.1 and 3.0.1 takes very little effort. You should probably try it.

Wow, so Selenium 3.0.0 and then Selenium 3.0.1 in just a few days. Should you use it?

I have a fairly small set of tests that I use on my Selenium WebDriver Online Course and I’ve run these against pretty much every version of Selenium WebDriver and browser version released.

I spent time last week and this week running them against:

  • Selenium 2.53.1
  • Selenium 3.0.0
  • Selenium 3.0.1

To be honest, I wasn’t expecting Selenium 3 to move out of Beta so fast. I wasn’t expecting this extra work so soon. But having a stable version is all the better because now I don’t have to answer questions about beta software.

The most obvious difference between Selenium 3.0.1 and Selenium 3.0.0, for me, was that HTMLUnit (v 2.23) works in Selenium 3.0.1. So I wouldn’t use Selenium 3.0.0.

Now my choice is between 2.53.1 or 3.0.1

Getting Started

Creating instructions to help people get started with WebDriver is a painful job when the version keeps changing and drivers keep changing names so I’m happy for some stability

I’ve updated my Start Using Selenium WebDriver project:

https://github.com/eviltester/startUsingSeleniumWebDriver

  • to use 3.0.1 in the pom.xml
  • updated the speedrun install notes

I’ve left instructions for 2.53.1 in there, but I’ll phase those out after a few point releases of Selenium 3.

I recommend that people starting to learn Selenium WebDriver use Selenium 3.0.1 and use ChromeDriver as their default browser.

  • you’ll be up to date
  • you’re more likely to receive support rather than “upgrade to Selenium 3.0.1”

Why ChromeDriver?

Because it is much more mature than GeckoDriver, and if you do want to drop back to Selenium 2.53.1 you won’t have to make any changes.

WebDriver in CI locally and with Cloud vendors

I have a simple CI project on github

I run this locally on a bunch of browsers through Jenkins, and on travis-ci, and against SauceLabs and BrowserStack.

I had to make minor code changes when starting Firefox to upgrade to Selenium 3 and I found no obvious issues.

So I have upgraded my wdci project to use Selenium 3.0.1

  • SauceLabs:
    • Windows 10 - Edge v 14.14393
    • Windows 10 - Chrome v 53.0
    • Windows 10 - IE v 11.103
    • Windows 10 - FIREFOX v 49.0
    • Apple Mac - OS X 10.11, Safari 9.0
  • BrowserStack:
    • Windows 10 - Edge v 13
    • Windows 10 - Chrome v 53.0
    • Windows 10 - IE v 11
    • Windows 10 - FIREFOX v 49.0
    • Apple Mac - “El Capitan”, Safari 9.1
  • Locally
    • Windows 10 - Edge v 13
    • Windows 10 - Chrome v 53.0
    • Windows 10 - IE v 11
    • Windows 10 - FIREFOX v 49.0
    • Windows 10 - HTMLUnit v 2.23
  • Travis-ci
    • Linux HTMLUnit v 2.23
    • Linux Firefox v 47.1

All I had to change was how I started Firefox browser. Now this isn’t a particularly large set of tests, or even complicated tests. So it might not be enough to convince you.

What about Grid?

I normally try and use remote grids and they worked fine.

I did try on a local grid and the only thing I had to change was the version number in the file name of the selenium jar. Everything else worked for me.

Admittedly I don’t ‘do’ much with the local grid. But for basic usage I found no issues.

In fact, GeckoDriver v 0.11.1 worked better from a grid node, than it did from calling directly.

What about bigger code bases?

I haven’t found any issues with ‘Selenium’ in my main code.

My issues tend to be cross-browser or ‘cross-driver’ related, rather than Selenium related. And mainly relate to synchronisation - the bane of cross-platform execution.

i.e. Moving from Selenium 2.53.1 to 3.0.1 made no obvious difference to Edge, IE, Chrome, Safari

For Firefox, clearly we have to change how we instantiate the driver, and GeckoDriver is still a work in progress. But the legacy Firefox driver in Selenium 3.0.1 works just as well as the one in 2.53.1 so if you’re still using the FirefoxDriver rather than GeckoDriver I don’t think you’ll notice a difference during execution.

Issue Conflation

The problem I found was my tendency to conflate ‘driver’ issues with ‘Selenium’ issues.

It is easy to do that since we tend to upgrade driver versions at the same time as Selenium, and - in the case of HTMLUnit, I had to update the driver when I updated selenium.

But by moving to Selenium 3, we will hopefully have less of that confusion since the separation between driver and Selenium becomes much cleaner.

Summary

  • I have updated all my teaching projects to Selenium 3.0.1
  • It doesn’t take much to upgrade to Selenium 3. Hopefully for most projects it is a small tweak to the driver abstraction layer and you’ll be up and running quickly.
  • And you can continue using FirefoxDriver in legacy mode if that is still your default browser and driver.
  • Remember not to conflate ‘driver’ issues with Selenium 3 ‘issues’.

Since it is so easy to upgrade, and drop back to 2.53.1 if you need to. I think it is worth trying.

 

NOTE: 20161020 - updated to say that local grid worked fine when I tried it too.