⇓ Get Latest Updates ⇓

Enter your email address:

Check email in your inbox for confirmation to get latest updates Software Testing for free.

⇓ Categories ⇓

Netsparker Web Application Security Scanner

Top Six Reasons Why I Like Selenium!!

Several months ago I started working on a new test automation project for a web site and one of the first things to do was to evaluate and choose a tool for the task. The two main contenders were Selenium and IBM Rational Functional Tester. I chose Selenium and since then never got to regret this choice. Here are some of the main reasons I like this open source tool much better than the expensive commercial alternatives for web automation.


Reason 1: Selenium acknowledges the fact that to create useful tests you will have to code them

Yes, it gives you a tool that can record sequences of user interactions, but as a whole Selenium is not built with the assumption that this will be the main approach you will use to create your tests. The recording tool (which is a very easy to install Firefox plugin) is useful as a learning aid and maybe for very simple tests. But what I like most about it is that it can covert your recorded sequence to code in any of the supported scripting languages.

Top Six Reasons Why I Like Selenium

Reason 2: You get to choose the scripting language

Most commercial automation tools force you to use some Visual Basic dialect as a scripting language. If you are lucky you get something relatively functional like VBA (with TestPartner) or even VB.NET (with Rational Functional Tester). Otherwise you might be forced to code your tests in VBScript, which is really, really painful (the main reason why I don’t like QuickTest Professional). Rational Functional Tester also lets you use Java, which makes it my favorite among the commercial tools.


Reason 3: Selenium is language agnostic

You can use almost any programming language you want. C# and Java are popular and PHP is also an option if you are automating a PHP web app and want to stick to the same language for testing. Ruby is a great language that makes coding fun and the Selenium library for Ruby provides some domain-specific idioms for testing, similar to what Rails does for web development. If you are a Perl, Python or Groovy fan you can use them too. As an additional bonus you will be able to use any development environment you are comfortable with to write your scripts be it Eclipse, Microsoft Visual Studio or even Vi or Emacs if you want to.


Reason 4: Selenium has a powerful approach for locating UI objects

Most automation tools are surprisingly limited in the way they identify the UI objects to interact with. They let you locate a control by some unique property (like id) or by a collection of properties which together identify it uniquely on the web page. In my experience this approach is sufficient in only about half of the real-world cases.

Imagine a web page containing 3 identical OK buttons. The buttons are exactly the same and have no id’s or anything in their properties to distinguish them. Lets say that the first button is located in a form with id ‘signup’, the second is inside ‘order’ and the third is inside ‘invoice’. Most automation tools do not let you easily identify a UI object in relation to other objects in the page, i.e. you cannot say I want to click the button with caption ‘OK’, which is located inside the ‘signup’ form. Normally the most you get is I want to click the second button with caption ‘OK’ on the page. This will work, but only until you get a new version of your application with added additional OK button above the one you are interested in.

The XPath expressions in Selenium can locate objects in the DOM document hierarchy (“//form[@id=’signup’]//input[@type=’button’ and @value=’OK’]”) and are very powerful – for instance you can specify that you want to click the checkbox, which is located inside a table row next to a cell with some specific text in it.


Reason 5: Your tests will run on any browser without changes

While you should not expect that automated tests will catch most browser-dependent bugs (like broken layout), the option to run your tests on all browsers that you support is definitely useful. As with programming languages, Selenium offers you a wide choice of browser to run your tests on not only specific versions of IE and maybe Firefox (the choice you are likely to get from commercial test automation tools), but also Safari, Chrome and Opera. What is more important about 95% of your tests will run without any changes on all supported browsers. I don’t know other automation tool that does this.


Reason 6: It is surprisingly stable and robust for a 1.0 version

My experience with test automation is that if you want to run lots of long tests, you have to expect that something will go wrong at some point random crashes are not that uncommon in this business. Selenium is at least as stable as anything else I have tried and we routinely run hour long tests without any problems.


About Author:

Rohit Gupta is a blogger on SoftwareTestingBooks.com and working as a Quality Assurance in a reputed company from last 3 years. He likes to share his thoughts and knowledge via blog in the field of Software Testing.


Full Selenium Training Series

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>