Selenium is an open source testing tool which automates web browser actions. It provides tools that can interact with browser and can automate browser actions like click, input, select, navigate etc with the help of scripts. There are many testing tools available in the market like UFT, TestComplete etc. But now a days majority of people prefer Selenium as it is an open source Automation testing tool. You can download it for free. You need not pay to use this tool. This open source feature makes it one of the hottest tools in the market as everyone is looking to cut costs and keep the automation costs down to minimum.
If we take the example of Microfocus UFT formerly HP QTP, we need to pay a lot of money to use it commercially. However in the case of Selenium, all we need to do is go to Selenium official website, download the Selenium jar and start working.
It is used exclusively for Web based applications. For an example if you want to automate a desktop or a client server application or even a mainframe application, then Selenium is not the right tool for that. In order words, this is one of the limitations of Selenium that it cant automate desktop based applications. However, since majority of the projects are now web based, you will be able to automate majority of your applications.
One of the best advantages of Selenium is that it works on multiple Operating Systems. It is the only open source tool available in the market which supports both Windows & Mac OS. There is no other tool which has cross platform capabilities.
Platforms supported by Selenium
• OS X
Now there is a support for mobile automation. Appium as an extension of Selenium is used exclusively to test mobile applications in both Android & iOS platforms.
Selenium supports a variety of programming languages. You can write Selenium code in following languages:
You don’t have to be an expert in all. You just need to get proficient in one language and you are good to go. Most commonly used languages with Selenium are Java & Python. You may want to see a Quick comparison of Java vs Python here.
The most popular programming language used with Selenium is Java. One of the most commonly asked question is “I have developed my application with C#. Can I use Selenium with Java to automate C# based application?” The answer is Absolutely yes. The language that we use in your Automation code is completely independent of the language on which your application is built upon. So even if our application is built in Java, we can automate it with Selenium using Python as the programming language. We can use any of the programming language as it is independent from the language it is coded in.
One of the best features of using Selenium as an automation tool is the Multi-Browser support.
Selenium supports the following browsers:
2. Mozilla Firefox
3. Internet Explorer
It is the only tool which supports cross-browser testing. In case of any other automation tools like UFT, it is not really consistent in automating multiple browsers. However, we get same stability in all different browsers.
So we have learnt in this Selenium Tutorial that we can work on multiple browsers, we can use multiple programming languages apart from being an open-source tool. Because of these capabilities it is one of the most commonly used automation tools in the market right now. Because of these flexibilities, majority of people now don’t give a second thought about Selenium as there is no question of license and getting it renewed.
One of the drawbacks of Selenium is that as it is a free tool, there is no dedicated technical support which is available in other paid tools like UFT.
Components of Selenium
1. Selenium IDE is a record and playback plugin for Firefox & Chrome browsers. We can use it for prototype testing.
3. Selenium WebDriver is the most active component today for frameworks and it is an API used to interact directly with the browser.
4. Selenium Grid is used to provide us the capability of running tests in parallel across different machines and browsers simultaneously and it saves time enormously.
Who created Selenium?
In 2004, Selenium was created by Jason Huggins who was an engineer at Thoughtworks(Chicago).
He started giving demos to his team internally within Thoughtworks and soon came an idea to make it open source as a reusable Software Testing framework. Later he renamed it to Selenium Core.
Afterwards, soon came a new problem known as “Same Origin Policy Issue”.
Same Origin Policy Issue
How Selenium Core came into picture?
Because of the restriction imposed by the Same Origin Policy, automation testers had to keep the web server containing the web application and the Selenium Code together on the local machine. To overcome this issue, another engineer from Thoughtworks started working to counter this issue. The result was a server that will act as an HTTP proxy which will trick the browser to believe that the Selenium Core and the web application being tested are hosted on the same domain. He called it Selenium Remote Control(RC) or Selenium 1.
After came Selenium Grid
Patrick Lightbody was another engineer at Thoughtworks who was involved in the same project who created Selenium Grid so that we can reduce the test execution time as much as possible. Initially, he called it “Hosted QA” which could capture the browser screenshots at particular intervals as well as sending Selenium commands to different machines simultaneously. He was also responsible for making Selenium RC stable for large scale deployment.
Selenium was made open source and released at the end of year 2004.
In 2006, the enhanced Selenium Remote Control took over Selenium Core completely and was released as Selenium 1.
Then came Selenium IDE – For Record & Playback & prototyping tests
A Japanese guy, Shinya Kasatani created Selenium Integrated Development Environment(IDE), which was a Firefox extension for recording & playback in Firefox browser so that we can create simple test cases at a great speed. In 2006, he donated Selenium IDE to the Selenium project team. At this moment, Selenium IDE now supports Chrome browser as well.
Then WebDriver Came into Existence in 2007
In 2007, another Thoughtworks engineer started working on a project to create another testing tool to overcome some limitations of Selenium 1. He named it WebDriver. In Selenium 1, we always required a Web server to interact with the web browser. However, in Webdriver, this limitation as removed. It was considered as the 1st cross platform testing framework which could control the browser from OS level.
How Selenium 2 was Born
In July 8, 2011, Selenium 1 and WebDriver were merged to form Selenium 2.0 and an official announcement was made by Selenium blog https://seleniumhw.wordpress.com.
Selenium 3 – The latest version
It was released in October 2016, Selenium Remote Control(RC) is now being deprecated and its entire implementation is replaced with webdriver. You wont find Selenium Remote Control for download anymore from SeleniumHQ official website.
Selenium Releases History
Why Selenium Name?
While Selenium was in its early stages, there was a very popular paid tool named Mercury QTP now Microfocus UFT. Since Mercury is a poisonous compound, Jason Huggins cracked a joke that Selenium can be a good anti-dote for mercury poisoning. We can still see the after-effects of this anti-dote as Selenium has actually eaten quite a big share of UFT, formerly known as HP QTP.
Advantages & Disadvantages/Limitations of Selenium WebDriver
1. It is an open source tool so anyone can download it and start in a short time.
2. It supports multiple programming languages like Java, C#, Python, Perl, Ruby, PHP.
3. It is platform independent which means it supports multiple OS like Windows, Mac, Linux& Solaris.
4. It can be used for cross browser testing across Firefox, Chrome, IE, Safari& Opera.
5. It supports headless browser.
6. It is easily integrated with open source frameworks like TestNG, JUnit.
7. It can be easily integrated with CI-CD process for example Jenkins, Maven.
8. It supports parallel test execution along with Selenium Grid.
9. It supports testing AJAX functionalities and helps in monitoring changes in content without loading the page.
10. The browser interaction is realistic.
1. It supports only web based applications. There is no support for windows applications.
2. There is no official support or help for WebDriver.
3. We can not automate scenarios like barcode, captcha etc.
4. You need to learn programming.
5. It has no inbuilt mechanism for generating reports.
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.