A Comprehensive Guide to Selenium

Read it in 20 Mins

Last updated on
11th Mar, 2021
Published
09th Aug, 2019
Views
8,976
A Comprehensive Guide to Selenium

Do you wish to know what is Selenium? or Why is it used?  or Where is it used? To get the answers for all these questions and to clear all your doubts about Selenium, please read this introduction about Selenium automation carefully. This Guide to selenium will answer all your questions and will inspire you to learn more about Selenium and will bring you closer to your dream job.

As Selenium offers many advantages it has become more popular among testers and developers. While talking about automation testing, one thing often comes to our mind is which is the favorite automation testing tool?  With simplicity, ease of use, availability and no cost selenium has become a favorite automation tool for many testers and developers. Selenium has made testers life easier.

What is Selenium?

So, lets us get answers to questions in your mind What is selenium? or What is selenium testing? or what is selenium software? or what is Selenium tool? Or what is selenium automation?

Selenium is a suite of tools that are used for testing web applications by automating the browser. It is an amazing tool used for automating the tests carried out on web browsers. Selenium Test scripts can be written in any programming languages Java, Python, C#, PHP, Ruby, Perl & .Net and test can be carried on any OS Windows, Mac or Linux. Selenium supports browsers Mozilla Firefox, Chrome, Internet Explorer, Safari or Opera. Selenium can easily integrate with other external tools like TestNg, Junit for test case management. It can also be integrated with Maven, Jenkins, Docker to get the benefit of continuous integration. It is a leading open source automation tool in the market. Selenium supports automation testing of functional aspects as well as UI testing of a web application with multiple browsers and OS support. Selenium makes frequent regression testing an easy task. Selenium ensures the quality of the software along with usability, security, and performance. Selenium suite contains four tools –

  • Selenium IDE (Integrated Development Environment
  • Selenium RC (Remote control)
  • Selenium WebDriver
  • Selenium Grid

Selenium tools

With the help of selenium cross-browser and cross-platform testing is possible and that is the reason selenium is used widely in the software industry for automation and demand for selenium is increasing. Implementation of selenium is easy and once setup is done creating selenium tests is an easy task. Selenium gives you the flexibility of design test cases manually or by record and playback approach. Selenium fits well with different software development life cycles such as DevOps, Agile, waterfall, etc.

Why Selenium?

As you are aware, technology is changing at a very fast pace. What is invented today becomes obsolete after a few days. It has become a necessity to automate the software to reduce manual efforts and ensure the quality of the software is maintained. There are many automation tools available in the market that delivers the same results then Why selenium? We will discuss this in detail and by the end of this article you will identify the benefits of selenium automation testing and why use selenium?

When we talk about automation selenium finds its way. It is widely used and preferred by testers and developers automation tool across the globe. Selenium has emerged as a leading automation tool. Selenium supports automation testing of functional aspects of a web application with a wide range of browsers and platforms support. Selenium ensures software quality, usability, security, and performance.

As open-source and free of cost selenium tool is extensively used across the world in Software Industry to automate test cases. In today’s fast-paced world, it has become very important to work smartly without compromising the quality of the product. Selenium gives you confidence in the quality of your product by avoiding human errors. Selenium tests are platform and browser independent and are easy to maintain and hence reduces maintenance cost. Because selenium is an open-source tool with a low maintenance cost, high quality, supports different software life cycles many software/IT organizations across the globe opt selenium as an automation tool.

History

Journey of selenium

Hey, let us travel into the past and see the gems who invented Selenium. Selenium history goes back to 2004. Jason Huggins a program, a basic tool ‘JavaScritpTestRunner’ as an internal tool to avoid repetitive Manual Testing. He named ‘JavaScriptTestRunner’ as ‘Selenium Core’ and made it open-source after identifying tremendous potential. To overcome ‘Same Origin Policy’ of Java Script in ‘Selenium Core’, Paul Hammant created a server that acts as an HTTP proxy to mimic browser that selenium core and web application under test come from the same domain and called it Selenium Remote Control (Selenium RC). Further, minimize test execution time Patrick Lightbody developed a tool “Hosted QA” later known as “Selenium Grid” which was capable of capturing screenshots and simultaneously sending selenium commands to different machines.

In 2005 Shinya Kasatani of Japan thought Selenium core can be bundled into Integrated Development Environment(IDE) module, and plugged it to FireFox browser as an extension that can automate browser using record and play features like QTP and come up with Selenium IDE.  Around 2006 Browsers and web applications were becoming more powerful. Simon Stewart at ThoughtWorks developed WebDriver Circa, first cross-platform testing framework that controls browser from the OS level. It has a client for every browser and high-level API. Later in 2008 selenium team decided to merge Selenium RC and WebDriver and create a new powerful tool called Selenium 2 with WebDriver as Core.

Currently, the latest Selenium 3 is in the market and version 4 is in the beta testing process.

Hope you enjoyed this selenium history.

Components

Below is the list of selenium components -

  1. Selenium IDE
  2. Selenium client API
  3. Selenium WebDriver
  4. Selenium Remote Control
  5. Selenium Grid

We already know that selenium is a suite containing different tools. A picture speaks a thousand words. Below picture will give you a high-level idea of selenium suite.

selenium suite Automation Testing

Now let us see each selenium component in details –

1. Selenium IDE –

Out of selenium suit, Selenium IDE (Integrated Development Environment) previously known as Selenium recorder is the simplest tool. Selenium IDE is an automated testing tool which supports record and playback actions.

Do you know the purpose behind creating selenium IDE? The purpose behind creating Selenium IDE was to increase the speed of test creation. This user-friendly interface has user actions record and play, which helps to create tests very quickly through its record and playback functionality. It is a portable software testing tool for web applications. Selenium IDE is Firefox add-on and one can download and use it without paying a single penny. Basically, Selenium IDE does not support iteration or conditional statements for test scripts.

Suppose you don't have programming knowledge but have a basic understanding of HTML, JavaScript, and DOM, Selenium IDE is an ideal tool for you. You don't need programming knowledge to work on selenium IDE. The menu bar of Selenium IDE allows you to create, save, edit, debugging of recorded Selenium IDE test scripts.

What are the features of Selenium IDE?

The editor in IDE has two views that are table view and source view. The Printing methods or we can say that log levels are used for generating logs during selenium testing. Such as Error, Warn, Info, Debug. So, That's all about the features of selenium IDE: a very efficient tool used in selenium 

2. Selenium client API

Selenium IDE has its very own scripting language called Selenese, which provides options for clicking a link, selecting something, retrieving data from opened pages. Instead of writing tests in Selenese, these tests can also be written in different programming languages. Tests communicate with selenium by calling methods in Selenium Client API. Selenium provides client APIs for Java, C#, Ruby, JavaScript, R and Python. With Selenium 2, a new Client API is introduced with WebDriver as its central component.

 3. Selenium WebDriver

Selenium WebDriver is a collection of APIs used to automate web application testing. It is a framework to automate browser that accepts commands and sends to browser through browser-specific drivers. WebDriver control browser by communicating with it. Selenium WebDriver supports Firefox, Chrome, IE and Safari browsers and Java, C#, PHP, Python, Perl, Ruby programming languages.

The main feature of Selenium 2.0 is the integration of the WebDriver API. It is designed to provide a simple, concise programming interface. It enables a user to use a programming language of their choice to write test scripts and enables to use conditional operations, looping and other programming concepts which helps to make test script robust.

To write UI tests with Selenium WebDriver you need to identify web page elements fast and with accuracy. Choose the right selection from the beginning so you don't need to visit these selectors very often.

Selenium WebDriver API identifies elements: by ID, by CLASS, by NAME, by CSS selector, by XPath, by TAG name. You can also define your custom selector in order to interact with the elements.

4. Selenium Remote Control

Selenium RC(Remote Control) is a tool that allows creating automated web application UI tests in any programming language.

The RC server bundled with Selenium Core and automatically injects it into the browser when your test program opens the browser using a client library API function. Selenium-Core is a JavaScript program which interprets and executes Selenese commands using the browser’s built-in JavaScript interpreter. You can use any programming language that can send HTTP requests to automated Selenium tests on the browser.

Selenium RC  supports programming languages like Java, PHP, Perl, Python, Ruby, etc and achieves logic required in test cases like conditional statements, iterations, exception handling, test reporting, database testing, capturing screenshots of failed tests, test case grouping.  It allows making use of programming language for maximum extensibility and flexibility in developing test logic.

Let us see how Selenium RC works. client libraries of selenium RC send a request to Server by passing each Selenium command for execution. Selenium server passes the Selenium command to the browser using Selenium-Core JavaScript commands and then browser, using JavaScript interpreter executes Selenium command.

Selenium RC is composed of two components -

  • Selenium Server -

It launches and kills browsers and interprets and runs the Selenese commands passed from the test program. For browser request, Selenium server acts as an HTTP proxy by intercepting and verifying HTTP messages passed between the browser and the AUT. In short Selenium Server receives Selenium commands from your program, Server interprets commands and reports back results of running test to your program.

  • Selenium Client -

Client libraries provide the interface between a programming language and the RC Server. Client libraries of different programming languages, instructs Selenium Server how to test the AUT bypassing server test script's Selenium commands.

The client libraries allow you to run Selenium commands from a program. Each supported language has different client library. The Selenium client library provides a programming interface (API) that run Selenium commands from your program. Each interface contains a programming function that supports each Selenese command.

Client library gets Selenese command and passes it to the Selenium Server for processing a specific action on the application under test (AUT) and receives the result of that command and sends it to your program. Your program stores received result into program variable and report is a success or failure.

Selenium RC is used to execute scripts on different browsers as RC supports multiple browsers like IE, Firefox, Chrome, Safari, Opera, etc.

Note – Selenium RC does not support reporting feature but by integrating with other popular tools, it provides flexibility in reporting.

5. Selenium Grid

Let us now talk about Selenium Grid. Selenium Grid is specialized in running multiple tests across different browsers, operating systems and machines in parallel and is part of Selenium Suite.

Two versions of selenium Grid are available Grid 1.0 and Grid 2.0. Our focus is Grid 2 as Grid 1 will be gradually deprecated.

HUB and Node concept is used in Selenium Grid where you run your test on a single machine called Hub and test will be executed on different machines called Nodes. Below picture will give you an idea of Hub and Node concept.

idea of Hub and Node concept

When you want to execute selenium test against different OS, on multiple browsers at the same time and save execution time you should use Selenium Grid.

What is Hub?

The central part where you load your test is called Hub. Grid contains only one Hub and is launched only on a single machine. Tests will be run on a machine containing Hub but you will see the browser on the node.

What are Nodes?

Node is selenium instance that executes tests you loaded on the hub. There can be more than one nodes in Grid. You can launch Nodes on multiple machines having different platforms and browsers. The platform of Node and grid need not be the same.

Pros and cons of Selenium

Selenium is widely used automation tool and has its own pro and cons.

Let us see what all are the selenium advantages -

  • Selenium is a browser and platform independent.
  • Selenium is open-source automation suite.
  • Selenium is most popular automation tool.
  • Selenium has huge developer community support.
  • Selenium integrates with other open-source tools.
  • It is a good fit for the development life cycle like DevOps, Agile, Waterfall.
  • With small changes according to your requirement framework can be used.
  • Selenium is easy to set up and once set up it is easy to write scripts, test functionality and reuse these scripts in the framework.
  • Selenium scripts are easy to maintain
  • By integrating with other reporting tools selenium provides flexibility in report generation.
  • Selenium test can be implemented without GUI.
  • Low maintenance cost
  • Selenium is widely used automation tool
  • Good demand for selenium experts, architects
  • It is a great tool for UI testing, UAT, Functionality testing, regression testing, unit testing, and acceptance testing.
  • Supports parallel test execution
  • It is lightweight and requires low hardware configuration requirements

And below are the selenium disadvantages –

  • Selenium supports automation on only Web Applications. You can not automate desktop applications or mobile applications.
  • As it is open source, direct support is not available.
  • User need to learn to program
  • It required a set of tools like JDK, Eclipse,  WebDriver, TestNG, etc. to set up
  • The default reporting feature is not available.
  • Selenium does not provide an API for extra work like test case design, report, build, CI-CD.
  • Automation of barcode/captcha is not supported
  • Built-in image comparison not supported

Automation Jobs

Selenium is widely used, and it has wide community support and caters testing needs very well. Being stable and proven framework, many giant software/IT companies across the globe like Facebook or Google are using selenium. A lot of software development companies across the world requires selenium professionals.

Selenium is scaling up with huge demand among automation tools as companies are making use of web applications. A lot of vendor tool provider supports Selenium technology and use it to automate web application testing. Scope for Selenium professionals for a job opportunity in automation testing will be always in demand at various expert levels.

The areas that see a bright future are continuous integrations, DevOps. Test automation engineers and QA engineers find exciting opportunities in the fields of Mobile testing, API testing, and Big data.

Various companies like Google, Mozilla, LinkedIn, ThoughtWork, IBM use Selenium. Again Multinational Companies like Infosys, Accenture, Wipro, Cognizant, TATA Consultancy, etc every year hire Automation Engineers with the sound knowledge of Selenium. As development teams are always in dire need of people who can help them with their knowledge of selenium tool. Due to benefits and ease that Selenium offers it is highly preferred automation software globally and you can think of making carrier in this field.

Selenium professionals are in great demand and get good salaries. Depending on the selenium expert level and experience salary depends. Also, sometimes it depends on company policy. One more factor that affects salary is the urgency of your skill. If a project is in line and the company requires your expertise then the company can pay you more.

Selenium training is easily available in the market online as well as offline and with knowledge of selenium, you can get good opportunities in the IT industry. From fresher to an expert to architect there are many selenium jobs available in the market for different level across the globe.

A software tester is responsible to provide a quality product without any bug or issue.

Skills required for selenium tester are –

  • Analytical skill
  • Positive attitude
  • Good communication skill
  • Database knowledge
  • Basic OS knowledge
  • Knowledge of scripting language
  • Knowledge of test management tool

Educational Qualification required for selenium tester –

Education in computer science such as a bachelor’s degree, engineering degree, master’s degree is desired for software tester. Engineering or bachelor’s/master's degree in information technology or computer science is sufficient to land a job as selenium tester.

If you are lacking in engineering or computer science degree, you can take up certification in selenium that will equip you as a professional with essential skills to work on the tool. 

  • Payouts –

Compensation of software tester varies from company to company and country to country. The average salary of a software tester in the US is between $45,993 and $90,539. Along with salary a software tester also gets other perks like a bonus, health insurance, gratuity.

On the other hand, an Automation Engineer based in the United States earn an average salary of $90,539 per annum.

  • Career Growth -

Tester has many ways to grow throughout the career. Starting as a 'Trainee' or 'Junior' you can constantly learn by obtaining new skills, taking responsibility and facing challenges and grow in your career. You can get opportunities as ‘Trainee/Junior’, Test Executor, Test designer, Senior Tester, Technical Tester, Test Architect, Test Manager, QA Manager and even sometimes Project manager.

Conclusion

Selenium is seeing exponential growth over the shorter period of time, as market trends of test automation are continuously changing. Because of selenium, the client receives a return on investment much faster by reducing the number of cycles in testing. Selenium is in massive demand since companies are increasingly making use of web applications. Test automation engineers can find highly exciting opportunities in the fields of Mobile testing, Big Data, and API testing.

And to conclude, selenium is in high demand and the right option for website testing. It is a popular tool in the market and will always be in demand. It is the first choice of the tester and  IT companies across the globe for GUI and functional testing of the web application.

Know completely about Selenium from our comprehensive blogs

Profile

Abhresh Sugandhi

Author

Abhresh is specialized as a corporate trainer, He has a decade of experience in technical training blended with virtual webinars and instructor-led session created courses, tutorials, and articles for organizations. He is also the founder of Nikasio.com, which offers multiple services in technical training, project consulting, content development, etc.