Learning Selenium
Selenium for automation testing
Selenium is an open source automation testing tool. We all know that today, we are living in an era where there is rapid software development happening across various domains. Testing these softwares is of utmost importance to ensure quality. The complex nature and with various functionalities involved in the softwares, test automation becomes a requirement in most of the software development projects. Automated testing or test automation refers to using a software tool for performing test cases and running repeatable test cases against the application under test. This reduces human intervention and increases speed of execution as well as test coverage. There are lots of tools available for automation testing these days. Selenium is one of the widely used automation tool that can be used for automating web based applications. It is to be noted that it can be used for web applications only and not for desktop applications.
Selenium in fact consists of a set of different tools catering to different needs of testing and with different approaches for testing. The Selenium tool suite consists of four different tools for automation testing:
- Selenium IDE: Selenium IDE (Integrated Development Environment) is a firefox plugin which can be used to automate tests to be performed in a browser using record and playback feature. It provides an easy to use interface for automating the test cases. However, Selenium IDE is designed to be a prototyping tool and you would have to use Selenium RC or Selenium WebDriver for automating and creating more advanced test cases.
- Selenium 1(Selenium RC): The older version of Selenium which was widely used until the introduction of Selenium WebDriver or Selenium 2. This version had many limitations related to security as it used a JavaScript based automation engine. Selenium RC has been officially deprecated and is used in maintenance mode only.
- Selenium WebDriver: Latest version of Selenium with most advanced features. It has an object oriented API and overcomes many limitations of the older version. Selenium 2, the older version of Selenium Webdriver is backward compatible and can run the older version Selenium RC interface. But the latest version, Selenium Webdriver 3 is not compatible with RC scripts. If you need to support RC scripts in Selenium 3 API, you will need some dependencies to use the package.
- Selenium Grid: This is the part of Selenium test suite which allows testers to run tests parallely across different machines, browsers, operating systems, etc. Selenium grid has old Grid 1 and new Grid versions available. But Grid 1 is deprecated by Selenium team recently. Selenium Grid comes inbuilt in the Selenium 2 and Selenium 3 server jar files.
Advantages of using Selenium for automation testing
As you might already know, Selenium has picked up to be the most in demand skill for automation testing over the past few years. Most of the testing profile jobs in job portals are related to Selenium. What is the main reason for this? How Selenium has outrun other automation tools like QTP/UFT with respect to job opportunities in market so quickly?
The main reason without any doubt is that Selenium is open source and completely free to use. A completely free tool with a hell lot of capabilities for automating web applications! That is Selenium. Who wouldn’t choose such a tool instead of paying thousands of dollars for acquiring license for another tool which has almost similar capabilities? This simply is the reason for the increase in popularity and use of Selenium across organizations. Good results with minimum investment.
Just being open source is not the only reason for using Selenium. It comes loaded with many features that make automating scripts easy. Here are some other advantages and features that make Selenium a cutting edge tool for automation.
-
Selenium is a highly portable tool for automation. Selenium scripts can run across various browsers including IE, Firefox, Chrome, Safai, etc and Operating systems including Windows, Linux, Mac.
-
Selenium supports use of different programming languages. The programming languages supported by Selenium are Java, csharp, php, python, ruby, perl and javaScript. So you could write your selenium scripts in any of your preferred language.
-
Selenium is highly flexible and allows programmers to manage tests better and easily.
-
Selenium can be integrated with various other open source tools like TestNG, Jenkins or Hudson, Maven, Ant, etc for better test management.
-
Selenium Grid enables parallel execution of scripts across systems.
-
Selenium has less hardware requirement compared to other automation tools like QTP/UFT.
-
Support of a wide and active community.
How to get started with Selenium
Now, we have seen the advantages of using selenium for automation web application, I hope you should be motivated enough to get started with Selenium. Now, the question is “Which selenium tool of the selenium tool suite should you start with”? Well, that partly depends on the level of automation you want to do and your programming skills. Selenium IDE is a great option to start with if you are not familiar with programming and you need to create simple scripts only. However, Selenium IDE is not recommended for serious automation.
There are limitations on the scope of automation that can be done using Selenium IDE. It is very easy to pick up and hence you can explore Selenium IDE as your first step to Selenium. For development of advanced automation scripts, Selenium RC or Selenium WebDriver is to be used. Selenium RC is deprecated and not used much these days. So, Selenium WebDriver is the tool you should get started with seriously. You can also consider tools like Browsee to do advanced testing automation with the same ease of use as Selenium IDE.
The first thing you have to know about Selenium WebDriver if you were used to UFT is you cannot start learning Selenium WebDriver without knowledge of any one of the programming language it supports. While UFT was a complete application which allowed you to record and playback tests and write tests without much programming knowledge (probably a little bit of VB scripting knowledge would have been enough). You should have good idea of OOPs concepts like classes, objects, etc, before starting with Selenium. So the first step to learn Selenium is to get familiarized with any one of the programming language. More than 70% of the Selenium developers use Java. Selenium with Python and Selenium with C# follows in popularity.
Given below is a step by step approach that would help you to learn Selenium in a systematic way.
- Learn any programming language supported by Selenium.
- Start with basic Selenium concepts like launching different browsers, locators used, handling different web elements, etc.
- Try writing small selenium codes or test cases to navigate to any site, perform some action on the site, sign in, etc.
- Once you are done with basic WebDriver concepts start with Frameworks, framework design principles and Build tools. Pick JUnit, TestNG or cucumber frameworks. Learn framework design principles like Page Object Model, Keyword driven framework, Data driven and hybrid frameworks. Now, go ahead with build/CI tools like Maven, Gradle and Jenkins for better test management using Selenium.
There are lot of tutorials available online for Selenium. Most of the tutorials are based on Selenium with Java which is most popular. Refer to the below list of tutorials and online courses to get started with Selenium.
Best Tutorials for Selenium
- Free Selenium Tutorials
- ToolsQA - Selenium Tutorials
- Selenium Tutorials 31+ Best Free Selenium Training Tutorials
- Selenium Tutorials for Beginners - Step by Step
- Selenium Tutorial
- Selenium Tutorial
- Selenium Webdriver tutorial for Beginners
- Selenium Tutorial
Best Courses For Selenium
However, if you already decided to take a deep dive, here are some of the best courses we found on Selenium.
For Beginner Level
- Selenium WebDriver with Java - Basics to Advanced& Interview Questions -- Paid
- Selenium WebDriver With Python 3.x - Novice To Ninja -- Paid
- Selenium WebDriver with C# for Beginners + Live Testing Site -- Paid
How much is a great User Experience worth to you?
Browsee helps you understand your user's behaviour on your site. It's the next best thing to talking to them.