What Is Selenium? A Beginner’s Guide To Automation Testing

Recommended by 17 users

May 5, 2017
What Is Selenium? A Beginner’s Guide To Automation Testing
Add to Bookmark Email this Post 6.8K    0

Do you know what is Selenium? Do you have any idea why it is used? If you want the answer to these two questions, then wait until you read the entire content of this blog because you will be glad you spent a worthy amount of time getting an introduction to what could be at the heart of your next job role.

Before I get started, let me tell you what you will get to learn by the end of this blog:

  1. Need for software testing
  2. Challenges with manual testing
  3. How automation testing beats manual testing?
  4. Selenium vs. other testing tools?
  5. Selenium suite of tools 

Selenium is an automation testing tool. Wait, before you get carried away, let me inform you that only testing of web applications is possible with Selenium. We can neither test any desktop (software) application nor test any mobile application using Selenium. It’ a bummer, I can feel your pain. But don’t worry, there are many tools for testing software and mobile applications like: IBM’s RFT, HP’s QPT, Appium and many more. But, the focus of this blog is, testing dynamic web applications and why Selenium is the best for that purpose. Before going into further details of Selenium, you ought to know the story behind how Selenium came into being what it is today.

Need For Software Testing

Software testing is where it all boils down to. Today’s world of technology is completely dominated by machines, and their behavior is controlled by the software powering it. Will the machines behave exactly as we want them to? Everytime? Everywhere? The answer to these questions lie in software testing. 

At the end of the day, it is the software application’s success rate which is going to control your business growth. The same thing can be said even for web applications because most businesses today are completely reliant on the internet.

Take for example, any e-commerce company. Be it Amazon or E-Bay or Flipkart, they rely on the customer traffic on their web sites and traffic on their web based mobile applications for business. Imagine, if something catastrophic happens like the prices of a number of products being capped off at 10$, all because of a small bug in a “not so easily readable” part of the code. Then what can be done, and how can we prevent it the next time? By testing the code before deployment right? So, this takes us to the next topic of manual testing.

Challenges With Manual Testing

Manual testing refers to the fact that, the web application being tested is done manually by QA testers. Tests need to be performed manually in every environment, using a different data set and the success/ failure rate of every transaction should be recorded.

manual testing challenges - what is seleniumLook at the above image of a poor chap, who manually verifies the transactions recorded. The challenges he is facing cause fatigue, boredom, delay in work, mistakes and errors because of manual work. This leads to the need for automation testing.

Automation Testing Beats Manual Testing

Automation testing beats manual testing every time. Why? Because it is faster, needs less investment in human resource, not prone to errors, frequent execution is possible, supports lights out execution, supports regression testing and also functional testing.

Let’s take a similar example to the one mentioned earlier. Suppose there is a login page and we need to verify if all the login attempts are successful, then it will be really easy to write a simple code which will validate if all the transaction/ login attempts are a success or not (automated test case execution). Moreover, these tests can be configured in such a way that they are tested in different environments and web browsers. What else can be done? You can automate the generation of result file, by scheduling it for a particular time during the day. Then you can also automate the generation of reports based on those results and what not. The key point is that automation testing makes a tester’s job a whole lot simpler. Check out the image below which shows a more relaxed environment in which the same tester is working.

automation testing - what is selenium

Now, let me talk about Selenium in particular.

What Is Selenium?

Selenium is a suite of software tools used to automate web browser testing. It is an open-source tool and is mainly used for functional testing and regression testing. Since it is open-source, there is no licensing cost involved, which is a major advantage over other testing tools.

selenium features - what is selenium

Other reasons behind Selenium’s ever growing popularity are:

  • Allows testers to write Selenese code in 7 different programming languages => Java, Python, C#, PHP, Ruby, Perl and JavaScript
  • It is not limited to, any environment and it allows testers to perform tests on various operating systems => Windows, Mac, Linux, iOS and Android
  • Testing can be done on different web browsers => Mozilla Firefox, Internet explorer, Google Chrome, Safari and Opera browsers
  • Most of all, we can integrate it with frameworks like TestNG, JUnit & NUnit for managing test cases and generating reports

But there surely has to be shortcomings right?

  • We can use Selenium only to test web applications. We cannot test desktop applications or any other software
  • There is no guaranteed support available for Selenium. We need to leverage the available customer communities
  • It is not possible to perform testing on images. We need to integrate Selenium with Sikuli for image based testing
  • There is no native reporting facility. But we can overcome that issue by integrating it with frameworks like TestNG or JUnit or NUnit

Learn Selenium From Experts

Now let us see where Selenium stands in the market.

Selenium vs. QTP vs. RFT

I have compared its performance with two other popular tools: QTP and RFT in the table below.

Features HP QTP IBM RFT Selenium
License Required Required Open-source
Cost High High Open-source software
Customer Support Dedicated HP support Dedicated IBM support Open-source Community
Hardware consumption during script execution High High Low
Coding experience Not required Required Ample amount of coding skills and experience needed
Environment support Only for Windows Only for Windows Windows, Linux, Solaris OS X (If browser & JVM or JavaScript support exists)
Language Support VB Script Java and C# Java, C#, Ruby, Python, Perl, PHP and JavaScript

It is pretty clear from the above table why Selenium is the most preferred tool. In the next part of what is Selenium blog, let’s go into the depths of Selenium by understanding the different flavors it comes in.

Selenium Suite Of Tools

  • Selenium RC (Now depreciated)
  • Selenium IDE
  • Selenium Grid
  • Selenium WebDriver

Selenium RC (Remote Control)

Before I talk about the details of Selenium RC, I would like to go a step back and talk about the first tool in the Selenium project. Selenium Core was the first tool. But, Selenium Core hit a roadblock in terms of cross-domain testing because of the same origin policy. Same origin policy prohibits JavaScript code from accessing web elements which are hosted on a different domain compared to from where the JavaScript was launched.

To overcome the same origin policy issue, testers needed to install local copies of both Selenium Core (a JavaScript program) and the web server containing the web application being tested so they would belong to the same domain. The permanent solution to this problem turned out to be Selenium RC. What does RC do then?

RC overcame the problem by involving an HTTP proxy server to “trick” the browser into believing that Selenium Core and the web application being tested come from the same domain. Thus making RC a two-component tool.

  1. Selenium RC Server
  2. Selenium RC Client – Library containing your programming language code

RC Server communicates using simple HTTP GET/ POST requests. Look at the below image for understanding the RC architecture.

selenium rc - what is selenium

Selenium RC was the flagship tool from the entire Selenium project because it could be used to write web application tests in different programming languages.

But the drawback with RC is that every communication with the RC server is time consuming and hence RC is very slow. So slow, that it would sometimes take hours to complete single tests.

From Selenium v3 onwards, RC has been depreciated and been moved to legacy package. You can however download and work with RC, but unfortunately you cannot avail support for it. But on the flip side, why would you want to use a tool which is outdated, especially when there is a more efficient tool called Selenium WebDriver. Before I talk about WebDriver, let me discuss about IDE and Grid, which are the other tools that make up Selenium v1.

Selenium IDE (Integrated Development Environment)

Selenium IDE is a Firefox plugin which is used to quickly and frequently execute simple test cases. Test cases in IDE is created by recording the interactions which the user had with the web browser. These tests can then be played back any number of times.

The advantage with Selenium IDE is that, tests recorded via the plugin can be exported in different programming languages like: Java, Ruby, Python etc. Check out the below screenshot of Firefox’s IDE plugin.

selenium ide - what is selenium

But the associated shortcomings of IDE are:

  • Plug-in only available for Mozilla Firefox browser
  • It is not possible for testing dynamic web applications; only simple tests can be recorded
  • Test cases cannot be created via programming logic
  • Does not support Data Driven testing

These were some of the aspects of Selenium IDE. Let me now talk about Selenium Grid.

Selenium Grid

Selenium Grid was a part of Selenium v1 and it was used in combination with RC to run tests on remote machines. In fact, with Grid, multiple test scripts can be executed at the same time on multiple machines.

Parallel execution is achieved with the help of Hub-Node architecture. Hub controls the test scripts running on various browsers, operating systems and programming languages on multiple nodes.

selenium grid - what is selenium

Grid is still in use, and works with both WebDriver and RC. Now is the ideal time for me to talk about Selenium v2. Selenium v2 included WebDriver as part of the Selenium project. WebDriver is more efficient than RC and I will tell you why that is the case in the next section of the blog.

Selenium WebDriver

In contrast to IDE, Selenium WebDriver provides a programming interface to create and execute test cases. Test cases are written such that web elements on web pages are identified and then actions are performed on those elements.

WebDriver is an upgrade to RC because it is much faster. It is faster because it makes direct calls to the browser. RC on the other hand needs an RC server to interact with the web browser. Each browser has its own driver on which the application runs. The different WebDrivers are:

  • Firefox Driver (Gecko Driver)
  • Chrome Driver
  • Internet Explorer Driver
  • Safari Driver and
  • HTM Unit Driver

Version 2 of WebDriver is basically a byproduct of Selenium RC and Selenium WebDriver v1. But commercially, WebDriver was launched as part of Selenium v2. Currently, Selenium v3 is in use.

Benefits Of Selenium WebDriver:

  • Support for 7 programming languages: JAVA, C#, PHP, Ruby, Perl, Python and JavaScript.
  • Supports testing on various browsers like: Firefox, Chrome, IE, Safari
  • Tests can be performed on different operating systems like: Windows, Mac, Linux, Android, iOS
  • Overcomes limitations of Selenium v1 like file upload, download, pop-ups & dialogs barrier

Short-comings Of Selenium WebDriver

  • Detailed test reports cannot be generated
  • Testing images is not possible

No matter the challenge, these shortcomings can be overcome by integrations with other frameworks. For testing images, Sikuli can be used and for generating detailed test reports, TestNG can be used.

So that draws the conclusion to this blog on what is Selenium. To learn more about Selenium WebDriver and TestNG, read the other blogs in this Selenium tutorial blog series. You can alternatively see the video below delivered by an industry expert where she has shared her opinion of Selenium as an automation testing tool.

What Is Selenium? | Selenium Tutorial | Edureka

 

This Edureka Selenium tutorial video will give you an introduction to software testing. It talks about the drawbacks of manual testing and reasons why automation testing is the way forward.

Learn Selenium From Experts

If you wish to learn Selenium and build a career in the testing domain, then check out our interactive, live-online Selenium 3.0 Certification Training here, that comes with 24*7 support to guide you throughout your learning period.

Got a question for us? Please mention it in the comments section and we will get back to you.

VardhanAbout Vardhan (16 Posts)

Vardhan is a technology enthusiast working as a Sr. Research Analyst at Edureka. He has expertise in domains like Big data, Cloud computing and writes about Hadoop, Spark, Splunk, DevOps, Salesforce and Selenium.


Share on
Comments
0 Comments

24 X 7 Customer Support X

  • us flag 1-800-275-9730 (Toll Free)
  • india flag +91 88808 62004