Selenium training in Hyderabad by Subba Raju | QA Training Hub

April 2, 2023
Selenium training in Hyd by Subba Raju

Selenium Training in HyderabadA Comprehensive Guide
What To Learn?
This Selenium training in Hyderabad by Subba Raju will provide you with the basic and advanced concepts of Selenium, and hence, it is designed for both beginners and professionals. This tutorial includes all the topics of Selenium such as introduction to Selenium, Selenium types, Selenium WebDriver, Maven in Selenium, and so much more.

Introduction to Selenium
Selenium is a free, open-source automated testing suite for web applications. It supports cross-browser and cross-operating-system interoperability. Selenium is quite similar to HP’s Quick Test Pro (QTP, now UFT), but Selenium focuses only on automating web-based applications. Testing done using the Selenium tool is usually referred to as Selenium testing.

Selenium is useful for testing web applications only. Neither desktop (software) testing nor the testing of mobile applications is possible with Selenium. A web application is an application program that is stored on a remote server, which is allowed to be accessed through a web browser over the internet.

Many websites contain web applications. Any website component that performs functions for users qualifies as a web application.

To test the performance of web applications, companies carry out the testing process. The testing of web applications done through the Selenium tool is referred to as Selenium testing.

What is Selenium WebDriver?
In this Selenium tutorial, let’s dig deeper into Selenium WebDriver. Let’s understand more about what Selenium WebDriver is, what browser elements are, and how to locate browser elements on a web page.

Locating and testing web elements in the web application
In Selenium WebDriver, you have the liberty to write test scripts in different programming languages, such as Java, Python, Ruby, C#, PHP, and JavaScript. However, 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. The major breakthrough happened in the Selenium project when WebDriver was developed and introduced as an addition to Selenium v2. With the release of Selenium v3, RC was deprecated and moved to a legacy package. Although you can still download WebDriver and carry out tasks with RC. There would not be any support for it in Selenium v3.

In a nutshell, 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 over RC is that test reports cannot be generated in WebDriver; whereas, RC generates detailed reports. You must have heard the term ‘browser elements’ a number of times. The next part of this automation testing tutorial for beginners will be about browser elements, and you will see how testing happens on these web elements.

What are Browser Elements?
Browser elements are different components present on web pages. The most common elements you will notice while browsing is:
– Text/Password boxes
– CTA buttons/Submit
– Images/Pic
– Hyperlinks/Anchors
– Radio buttons/checkboxes
– Text area/error messages
– Dropdown box/list box/combo box
– Web table/HTML table
– iFrame, Frames etc.

Testing these elements essentially means, you have to check whether they are working fine and responding the way you want them to. For example, if you are testing a text box, what would you test it for?
1. Whether you are able to send text or numbers to the text box
2. If you can retrieve the text that has been passed to the text box, etc.

If you are testing an image, you might want to:
Download the image
Upload the image
Click on the image link
Retrieve the image title, etc.
Similarly, operations can be performed on each of the elements mentioned earlier. However, only after the elements are located on the web page, you can perform operations on them and start testing them.

Locating Browser Elements Present on a Web Page

Each element on a web page does have an attribute (property). Elements can have multiple attributes, and most of these attributes will be distinctive for different elements. Consider an example. Suppose there is a page having two elements: an image and a text box.

Both these elements have a ‘Name’ attribute and an ‘ID’ attribute. These attribute values need to be distinctive for each of these elements. In other words, no two elements can have the same attribute value.
In the above example, the image and the text box can have neither the same ‘ID’ nor the same ‘Name’ value. However, there are some attributes that can be common for a group of elements on the page, e.g., a group of elements can have the same value for ‘Class Name’.
There are eight attributes that can be used to locate elements on a web page; they are ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, CSS, and XPath. Since the elements are located using these attributes, they are referred to as ‘locators’. The locators are:
By.id
driver.findElement(By.id(“***”));
By.name
driver.findElement(By.name(“***”));
By.className
driver.findElement(By.className(“***”));
By.tagName
driver.findElement(By.tagName(“***”));
By.linkText
driver.findElement(By.linkText(“***”));
By.partialLinkText
driver.findElement(By.partialLinkText(“***”));
By.css
driver.findElement(By.css(“***”));
By.xpath
driver.findElement(By.xpath(“***”));

By looking at the syntax above, you might have realized why locators are called inside methods.
Now, you need to learn all the other methods, browser commands, and functions that can be used to perform operations on the elements. But before moving on with the hands-on, creating an automated test, let’s first understand what dependencies are and how they help you in creating a Maven project.
You will need certain dependencies and libraries ready with you for the Selenium project, which will help you perform automated testing of a web application, and such a tool is known as Maven.

Selenium Types
In this Selenium Training in Hyderabad, let’s take a look at the selenium types. Selenium is not just a single tool but a suite of software, each catering to different testing needs of an organization. It has four components:
– Selenium Integrated Development Environment (IDE)
– Selenium Remote Control (RC)
– Selenium Grid
– Selenium WebDriver

Now that you know about its types, let’s talk about each one of them briefly.
Selenium IDE
Selenium IDE (Integrated Development Environment) is a tool that helps you develop your test cases. It is 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 was contributed to the Selenium project in 2006.
It was introduced as a Firefox plugin for the faster creation of test cases. As it was a Firefox extension, it could automate the browser through a record-and-play feature providing auto-completion support and the ability to move commands around quickly.
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 pages.
The advantage of Selenium IDE is that the tests recorded via the plugin can be exported in different programming languages, such as Java, Ruby, Python, etc.

Selenium RC (Remote Control)
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, a ThoughtWorks’ 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 (the library containing the programming language code)

RC can support the following programming languages:
Java
C#
PHP
Python
Ruby

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 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.

Selenium WebDriver
It was founded by Simon Stewart, a ThoughtWorks’ Consultant in Australia, in 2006. Selenium WebDriver was the first cross-platform testing framework that could control the browser at the OS level. Selenium WebDriver is a successor to Selenium RC. Selenium WebDriver accepts commands (sent in Selenium or via a Client API) and sends them to the browser.
This is implemented through a browser-specific driver, which sends commands to the browser and retrieves the results. Each driver launches and accesses a browser application. Different WebDrivers are:
FirefoxDriver (GeckoDriver)
ChromeDriver
InternetExplorerDriver
MicroEdge
OperaDriver
SafariDriver
HTMLUnitDriver

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, namely, 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, such as file upload, download, pop-ups, and dialog barrier

Cons of Selenium WebDriver
Detailed test reports cannot be generated.
Testing images is not possible.

Leave a Comment