Blog

go back to the blog

Selenium 2: What is it?

  • 15/08/2011
  • 8015 Views
  • no comments
  • Posted by EuroSTAR
-->

A Selenium 2 has recently been released. With this release my fellow Selenium Committers are really excited to be releasing one of the best browser automation frameworks in the world.

For those who don’t know what Selenium is let me explain. Selenium is a framework that allows developers and testers to create automated tests against a web application by controlling the browser. It was created by Jason Huggins while working at ThoughtWorks. It was created as a tool to make sure that the quality of the ThoughtWorks Time and Expense Reporting application was high. Jason and the team he was on went from breaking the application in Internet Explorer to breaking in Firefox.

A few years later, Simon Stewart created a different automation framework for driving the browser. He called his project Webdriver. He wanted to solve the issue of driving the browser but from a different direction. Simon was trying to solve slightly different issues while driving the browser.

But these two projects happily co-existed. Then Simon and Jason had a discussion about merging the projects.

This lead to the creation of Selenium 2. Each project had their strengths and weaknesses. Fortunately where one had a weakness the other had a strength. A number of people have hit issues with Selenium in the past, for example using a unsecure site and trying to log in, which redirects you to the secure version of the site. Because Selenium is written in JavaScript the browser would block that type of action. The reason for this is Same Origin Policy in browsers. It prevents JavaScript coming from one place interacting with pages that are not from the same place. This is a standard security feature in browsers.

The other issue commonly hit by Selenium users is that they would like to do a file upload. Again, Selenium can’t do this due browser security restrictions. JavaScript can’t access file input (<input type=file>). Browsers prevent it from accessing that type of element because it could mean that a password file could be uploaded without your knowledge.

These problems are easily solved by WebDriver however WebDriver didn’t support as many browsers as Selenium but in the last few months we are seeing more support being added. We have also seen that WebDriver supports mobile devices, like iOS and Android, so that you can automate your site on your iPad. It works both on the device as well as in the emulator. As we all know, Mobile is going to be the future with the rise of smart phones and tablet devices so we have to put a lot of effort into making sites work on these devices.

So now with the merger between the two projects we can test web applications in a way that was never really possible. We can draw on canvas elements as shown with this tutorial(http://www.theautomatedtester.co.uk/blog/2011/selenium-advanced-user-interactions.html ). This is something that people have wanted to do for a while now.There are a number of different problems that have risen from working with HTML5 but to be honest if it wasn’t challenging we wouldn’t be in this business.

So go have a play with the new WebDriver API and see how much more you can do with your browsers. If you want to see some examples of how Mozilla do their Selenium tests, have a look at Mozilla Origanization on Github (http://github.com/mozilla/ ).

If you would like to see what my team, Automation Services (https://lists.mozilla.org/listinfo/dev-automation) and the the web qa team(https://mail.mozilla.org/listinfo/mozwebqa) are up to sign up to their mailing list. There will be discussions on what and how we are doing this as well as discussing test days so you can help get involved!

Blog post by

go back to the blog

eurostar

Leave your blog link in the comments below.

EuroSTAR In Pictures

View image gallery