What's New in Selenium?

It's hard to believe, but Selenium is about to turn 11 years old. Selenium was originally developed in 2004 by Jason Huggins at ThoughtWorks as a tool to help out with some internal projects. A lot has changed since then, and not just in Selenium. This new automation tool set made something that was previously very difficult and fragile — automation of tests in a browser — just a little easier to create and a lot more useful. These changes and developments in Selenium also had the side effect of creating a community of open source and commercial tools. Selenium is now becoming the de facto browser testing tool. You can learn how to get started with Selenium here.

Let's take a look at some of the latest developments that are keeping Selenium on the cutting edge of browser automation.

Native Events And FireFox

Your clicks just got a whole lot clickier for tests running in FireFox. The team recently added support for native events in the latest few versions (FireFox 24, 31, 32, and 33). What is a native event and what's that got to do with me, you ask? Native events are the signals your browser sends to the computer when you are working — mouse clicks, button presses on the keyboard, and scrolling. Normally these things come from a person making the browser do useful things, but with automation it's a little different. When Selenium first came along, they were sending what we think of as Generic Events; events that work across different browsers. Generic Events were useful because they got browser automation moving along, but they were a hack. Generic Events were simulated browser events that could be used across any browser, but sometimes there were problems.

Have you ever had those moments where something would work in your automated test, but not in the browser, or vice versa? It was probably related to how the events were being sent.

As of version 2.44, when you do something like window.click('button') in FireFox, you are actually causing the browser to fire a real click event. FireFox automation is more realistic than it has ever been.

More Support for Internet Explorer

If you are using the latest version of Internet Explorer 11, you're in luck. Microsoft developed a set of WebDriver bindings specifically for Internet Explorer aptly named InternetExplorerDriver. This implementation of WebDriver pairs up with a server called IEDriverServer.exe to form your testing environment. The problem with this was that InternetExplorerDriver was a separate implementation completely and couldn't possibly match the WebDriver feature set that has been growing over the past 10 years. That means that if you needed some specific functionality for your test, you'd probably end up using two different frameworks to get the job done.

Now that there is official support for Internet Explorer (check out the .net bindings), not only can you focus on one single tool, but if there is a missing feature you want you can fall back on WebDriver.

This is a bigger deal than it sounds, we will dive into the details about why a little later.

Start Testing On 1500+ Browsers with CrossBrowserTesting

Start Free Trial

Automated Visual Testing

Visual testing — looking at pages, and noticing changes between builds — has traditionally been very, very hard. To do this a few years ago you would have to navigate to every page in your app, or at least as many as you could remember, click the button or run the script for your visual tool to do some recording of CSS and DOM elements. This 'recording' is your benchmark, what every other version of your app will be compared to till you update the recording.

Now ,there are a few tools that will take advantage of the Selenium scripts that are already testing your software. Instead of making a separate pass through on each screen in your software, these tools follow along with your scripts and take a digital snap shot for each page that your script lands on. When you run your scripts again, each existing snapshot is compared to what you would see if you were looking at the website yourself. Visual test automation is now almost a hands-off matter.

In The Works For Selenium

Some of the most exciting things to come in are already in motion. The Selenium team has been working for some time now to get an official WebDriver specification published through the W3C. The draft is currently in 'working draft' state and hasn't been updated since March 2013. This has been a lot of work for the hardworking people on the Selenium project and will have a big impact on WebDriver users and also on the wider testing community.

An official WebDriver specification means that browser vendors will be able to create and maintain browser specific implementations of WebDriver. Microsoft has already begun using the new spec even though it isn't official and built an Internet Explorer specific implementation of WebDriver that you can use in IE 11 and newer. Blackberry and Safari are following suit. What this means to you, the user of the WebDriver framework, is that you can now rest a little easier. Browser updates will be more likely to continue working with the version of WebDriver you're using, and if they do break something will likely come with a WebDriver update.

For Selenium, this means they are taking another step toward becoming the default browser level testing framework.

More to Come

These are just some of the latest changes. The momentum and growing fan base Selenium has developed over the past 10 years doesn't seem to be slowing. Selenium 3 will follow shortly after the official WebDriver specification is approved and published by the W3C. After that, I expect there will be a flood of new features, integrations, and interest.

Stay tuned, there is plenty more to come.