Selenium Tutorial

Selenium Tutorial

Last updated on 19th Sep 2020, Blog, Tutorials

About author

Ramesh (Sr Technical Project Manager )

He is A TOP Rated Domain Expert with 11+ Years Of Experience Also, He is a Technology Writer for Past 5 Years to Imparts Informative Blog for Fresher's & JOB Seeker

(5.0) | 17309 Ratings 999

Selenium is a free and open-source test automation suite used for automating web-based applications. It supports automation across different browsers, platforms, and programming languages

Using Selenium, we can automate the functional tests and easily integrate them with Maven, Jenkins, and other build automation and continuous integration tools.

Components of Selenium Suite

Selenium Suite comprises of the following four components-

  1. Selenium IDE – Selenium IDE is a tool that helps you develop your Selenium test cases. It’s an easy-to-use Chrome and Firefox extension and is generally the most reliable method to develop test cases. It records users’ actions in the browser for you, using the existing Selenium commands, with parameters defined by the context of the web element. This is not only a time-saver but also an excellent way of learning Selenium script syntax. Previously known as Selenium Recorder, Selenium IDE was initially created by Shinya Kasatani, of Japan and contributed to the Selenium project in 2006.  Scripts are recorded in a special test scripting language called Selenese for Selenium. Selenese comes up with commands for carrying out actions in a web browser and restoring data from the resulting page.    Advantage of Selenium IDE -The tests recorded via the plugin can be exported in different programming  languages like Java, Ruby, Python, etc.
  2. Selenium RC – Selenium Remote Control(RC) is officially deprecated by Selenium. Selenium Core was the first version. But with that version, testers had to install both Selenium (a JavaScript program) and the webserver containing the web application being tested on their local systems so that they would belong to the same domain.Then, another  engineer, Paul Hammant decided to create a server that will act as an HTTP proxy to trick the browser into believing that Selenium Core and the web application being tested belong to the same domain, thus making RC a two-component tool.
  • Selenium RC Server
  • Selenium RC Client (Library containing the programming language code)
  1. Selenium WebDriver – Locating and testing of web elements in the web application is implemented through a browser-specific driver. It controls the browser by directly communicating with it.In Selenium WebDriver, you have the liberty to write test scripts in different programming languages like Java, Perl, Python, Ruby, C#, PHP, and JavaScript. But, make a note that Mozilla Firefox is Selenium WebDriver’s default browser.WebDriver was introduced as part of Selenium v2.0. Selenium v1.0 consisted of only IDE, RC, and Grid. But the major breakthrough in the Selenium project was when WebDriver was developed and introduced as an addition in Selenium v2. And, with the release of Selenium v3, RC has been deprecated and moved to a legacy package. Although you can still download webdriver and carry out tasks with RC, there wouldn’t be any support for it in Selenium v3.

Benefits of Selenium WebDriver

  • Selenium WebDriver supports seven programming languages: Java, C#, PHP, Ruby, Perl, Python, and .Net.
  • It supports cross-browser interoperability that helps you perform testing on various browsers like Firefox, Chrome, IE, Safari, etc.
  • Tests can be performed on different operating systems: Windows, Mac, Linux, Android, and iOS.
  • Selenium WebDriver overcomes limitations of Selenium v1 like file upload, download, pop-ups, and dialog barrier

     Cons of Selenium WebDriver

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

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

Subscribe For Free Demo

Error: Contact form not found.

The advantages  WebDriver has over RC are:

  • Support for more programming languages, operating systems, and web browsers
  • Ability to overcome the limitations of Selenium v1
  • Simpler commands when compared to RC, and a better API
  • Support for batch testing, cross-browser testing, and data-driven testing

The drawback WebDriver has when compared to RC is that test reports cannot be generated in WebDriver; whereas, RC generates detailed reports.

  1. Selenium Grid – Selenium Grid is a testing tool that lets you run your tests on various machines against different browsers. It is part of the Selenium suite that specializes in running multiple tests across different browsers, operating systems, and machines. You can connect to it with Selenium Remote Control by stating the browser version, browser, and operating system as per your choice. You will be able to specify these values through Selenium Remote Control capabilities. With Selenium Grid, one server makes a move as a hub. Tests communicate to the hub to get access to browser instances. The hub has a list of servers that provide access to browser instances (WebDriver nodes) and lets tests use these instances.Selenium Grid allows parallel testing and also allows managing different browser versions and browser configurations centrally (instead of in each individual test).There are multiple online platforms that provide an online Selenium Grid that you can access to run your Selenium automation scripts. For example, you can use LambdaTest. Selenium Grid has more than 2,000 browser environments over which you can run your tests and truly automate cross-browser testing.

  Advantages of Selenium

Let’s now see some of the advantages of Selenium-

  • Selenium is open source, there is no licensing cost for its usage.
  • Scripting can be done in most of the widely used programming languages like Java, C#, Ruby, and Python.
  • It supports most of the popular browsers like Chrome, Firefox, Internet Explorer, Opera, and Safari.
  • Selenium IDE component of the Selenium suite provides record and playback features using which non-programmers can also write automation scripts.
  • Selenium Grid helps in parallel and distributed testing.

Limitations of Selenium

            Some of the limitations of Selenium are-

  • Selenium does not provide desktop application automation support.
  • Web Services – REST or SOAP cannot be automated using Selenium.
  • Selenium WebDriver requires programming language requirements for script creation.
  • For performing common tasks required in automation like logging, reading-writing to external files, we have to rely on external libraries.

Installation Steps

In order to develop Selenium RC or WebDriver scripts, users have to ensure that they have the initial configuration done. Setting up the environment involves the following steps.

  • Download and Install Java
  • Download and Configure Eclipse
  • Configure FireBug and FirePath
  • Configure Selenium RC
  • Configure Selenium WebDriver
Download and Install Java

We need to have JDK (Java Development Kit) installed in order to work with Selenium WebDriver/Selenium. Let us see how to download and install Java.

Step 1 − Navigate to the UR.

https://www.oracle.com/technetwork/java/javase/downloads/index.html

Step 2 − Go to “Downloads” section and select “JDK Download”.

Download-Install-java

Step 3Select “Accept License Agreement” radio button.

java-se-development-kit

Step 4 − Select the appropriate installation. Click the appropriate link and save the .exe file to your disk.

Step 5 − Run the downloaded exe file to launch the Installer wizard. Click ‘Next’ to continue.

Step 6 − Select the features and click ‘Next’.

java-se-development-custom-setup

Step 7 − The user can choose the install location and click ‘Next’.

Step 8-The installer installs the JDK and new files are copied across

Course Curriculum

Get Advanced Selenium Training for Beginners to Enhance Their Career

  • Instructor-led Sessions
  • Real-life Case Studies
  • Assignments
Explore Curriculum

Step 9 The Installer installs successfully and displays the same to the user.

Step 10 − To verify if the installation was successful, go to the command prompt and just type ‘java’ as a command. The output of the command is shown below. If the Java installation is unsuccessful or if it had NOT been installed, it would throw an “unknown command” error.

cmd-window

Download and Configure Eclipse

Step 1 − Navigate to the URL: https://www.eclipse.org/downloads/ and download the appropriate file based on your OS architecture.

eclipse-url

Step 2 − Click the ‘Download’ button.

eclipse-download-button

Step 3 − The download would be in a Zipped format. Unzip the contents.

zipped-format

Step 4 − Locate Eclipse.exe and double click on the file.

locate-eclipse.exe-and-double click-on

Step 5 − To configure the workspace, select the location where the development has to take place.

select-the-location

Step 6 − The Eclipse window opens as shown below.

eclipse-window

Configure FireBug and FirePath

To work with Selenium RC or WebDriver, we need to locate elements based on their XPath or ID or name, etc. In order to locate an element, we need tools/plugins.

Step1− Navigate to the URL

https://addons.mozilla.org/en-US/firefox/addon/firebug/ and download plugin.

add-ons-url

Step 2 − The add-on installer is shown to the user and it is installed upon clicking the ‘Install’ button.

install-add-ons

Step 3 − After installing, we can launch the plugin by navigating to “Web Developer” >> “Firebug”.

web-developer

Step 4 − FirePath, a plugin that works within Firebug, helps users to grab the ‘XPath’ of an element. Install FirePath by navigating to “https://addons.mozilla.org/en-US/firefox/addon/firepath/”

install-firepath

Step 5 − The add-on installer is shown to the user and it is installed upon clicking the ‘Install’ button.

software-installation-firepath

Step 6 − Now launch “Firebug” by navigating to “Tools” >> “Webdeveloper” >> “Firebug”.

Course Curriculum

Enroll in Selenium Training & Certification Course By Selenium Experts

Weekday / Weekend BatchesSee Batch Details

Configure Selenium RC

Now let us look at how to configure Selenium Remote control. We will understand how to develop scripts with Selenium RC in later chapters, however for now, we will understand just the configuration part of it.

Step1-  Navigate to the Selenium downloads section http://www.seleniumhq.org/download/ and download Selenium Server by clicking on its version number as shown below.

selenium-download

Step 2 − After downloading, we need to start the Selenium Server. To do so, open command prompt and navigate to the folder where the downloaded JAR file is kept as shown below.

cmd-window

Step 3 − To start the server, use the command ‘java -jar <<downloaded jar name >> and if java JDK is installed properly, you would get a success message as shown below. Now we can start writing Selenium RC scripts.

start-the-server-cmd-window

Configure Selenium WebDriver

Now let us look at how to configure Selenium WebDriver. We will understand how to develop scripts with Selenium WebDriver in later chapters, however for now, we will understand just the configuration part of it.

Step 1 − Navigate to the selenium downloads section http://www.seleniumhq.org/download/ and download Selenium WebDriver by clicking on its version number as shown below.

selenium-client-&-webdriver

Step 2 − The downloaded file is in Zipped format and one has to unzip the contents to map it to the project folder.

Zipped-format

Step 3 − The Unzipped contents would be displayed as shown below. How to map it to the project folder and how to start scripting would be dealt in the webDriver chapter.

unzipped-format

Why Developers prefer Selenium With Java?

A good community of developers to create documentation and resolve issues has helped Java to become the most preferred language among the application developers. Thus, writing selenium test cases using Java has multiple benefits:

  • Selenium supports Java. So, testers can leverage the active community of contributors and detailed documentation to write test cases
  • Programs written in Java are faster than other popular languages like Python
  • Java is more widely used in commercial applications as compared to other programming languages like Python and hence integrating Selenium tests it easier.

Eventually choosing the right language varies by project, organization, and individuals driving it. An essential criterion is to know the language in-depth when dealing with Selenium.

Selenium Career Opportunities

If you are thinking of pursuing a career in the web testing field, then you have landed on the right page. We will explain the various Selenium career opportunities that await trained and certified testers. The need for Selenium Web Testing has become one of the most integral parts of many businesses.

When there is a discussion about web testing tools, Selenium is surely one of the best in the field to help developers with automation testing. Hence, the demand for Selenium Web Testers is on the rise, and it is only going to increase in the future exponentially.

Selenium rose to become the most popular of all web testing tools, with a humongous 300 percent growth in terms of job postings during the previous three years, says Business Wire.

Selenium Future Scope: Major Companies Hiring Selenium Testers

If we are ready to dive deep into Software Testing and gain advanced-level expertise in it, then Selenium would be a cream puff for us. We can always enhance our skills for professional growth. Research by Forrester states testing as the ‘most popular phase of software delivery in which Artificial Intelligence can be applied.’

As there will be a continuous demand for software for various objectives in most of the companies and as no software has ever been produced without bugs, indulging with this open-source and easy-to-use tool will ensure us a fruitful career. There are plethora of MNCs that rely on Selenium and use it extensively for testing purposes such as Facebook, Microsoft. Cognizant, HP, Accenture, etc. They employ Selenium Testers with deep knowledge and Selenium certification.

selenium-future-scope

Automation testing is an innovative field and, in a software development process, the development and the testing fields are ever in need of talented testers who can help with easy releases of new versions and the maintenance of the software. As there are various benefits that Selenium brings to the table, it is a widely chosen tool, tempting us to think of making a career in Selenium Testing.

Selenium Jobs in 2020:

2020 already brings a fortune as it is expected to have 27,453 new openings for software testing jobs across India, as per Shine.com. According to Naukri, around 5,297 Selenium job openings are waiting to test our skills and employ us.

These stats clearly show that there are great opportunities waiting for us to make advancements in our career, only if we invest enough time and effort in upskilling and practicing constantly.

Now, let us talk about the ways to upskill ourselves in the testing domain. In the next section of this blog, we will also see various Selenium jobs that we can grab with our Selenium Testing skills!

Selenium Job Roles!! Upskill Yourself

Selenium job roles vary from company to company, ranging from a mobile development company to a web application development company. Also, our experience in the industry matters when it comes to undertaking a specific Selenium job role.

Some of the popular Selenium job roles that an automation testing company can offer us are:

  • Selenium Automation Engineer
  • Selenium Tester
  • Senior Quality Engineer – Automation
  • Mobile Testing Lead
  • Java Selenium Automation Engineer
  • Selenium Test Analyst
  • Senior QA Automation Engineer
  • Software Development Test Engineer
selenium-job-roles

The key skills required to take up any of these job roles are as follows: security testing, regression testing, performance testing, Java and Java APIs, testing QA automation, knowledge of automation frameworks, Selenium, functional testing, and JIRA.

selenium Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

Certification in Selenium:

CP-SAT

CP-SAT stands for “Certified Professional-Selenium Automation Testing”. It is #1 global certification in selenium. It is designed with concepts of testing web applications using selenium. The CP-SAT training is conducted by a trained (Licenced) trainer. Trainers should have excellent experience and also be CP-SAT certified.

Selenium Testing Training and Certification are available with multiple programming Languages

  • Selenium with JAVA
  • Selenium with Python
  • Selenium with C#

         A4Q Selenium Tester Foundation Certification

     The A4Q Selenium Tester Foundation Certification is based on a practical training course aimed at test professionals who desire an understanding of how to design, implement and maintain automated solutions using selenium webdriver. This certification is for anyone who wants to validate and demonstrate skills in using Selenium Test Driver in Test automation. This course is ideal for automators and those who want to learn automation using the Selenium WebDriver toolset. While this course is accessible to anyone wanting to acquire basic, hands-on knowledge in selenium.

Other certifications

  • To extend  knowledge further in Test Automation gain ISTQB certification. ISTQB Certified Tester Advanced Level Test Automation Engineer.
  • For Agile Environment, ISTQB Certified Tester Foundation Level Agile Tester.

Are you looking training with Right Jobs?

Contact Us

Popular Courses