selenium tutorial
Automatic software technology system for efficient work with the most advanced technology, business process concepts
  1. What is Selenium
  2. Selenium Basic Terminology
  3. Features of Selenium
  4. Limitations of Selenium
  5. Selenium Vs QTP
  6. IDE (Selenium Integrated Development)
  7. Selenium IDE Installation
  8. Selenium IDE Features
  9. IDE First Test Case
  10. Selenium-IDE Login test
  11. Selenium IDE- Commands (Selenese)
  12. IDE Locating Strategies
  13. Selenium Web driver
  14. What is Selenium Grid?
  15. Conclusion

What is Selenium? 

Selenium is an open-source tool and portable framework that is used for automating the tests administered on web browsers. It is only used for testing web applications such as Shopping Carts, Email Programs like Gmail, Yahoo.

Testing done using Selenium is often referred to as Selenium Testing.

Selenium is not just a single tool, as it is a collection of softwares, and each tool has different cases of testing. 

Now, you might be wondering, who created Selenium? 

Selenium was introduced by Jason Huggins in 2004. Jason Huggins an Engineer at Thoughtworks. He was doing his work on some web application and he suddenly required testing. 

He realized that mundane Manual Testing (used to identify bugs, issues, and defects in software)  of their application was turning to be more and more ineffective. 

He created a JavaScript Program that would instinctively control the browser’s action. And he named the program “JavaScriptTestRunner” and later he made JavaScriptTestRunner as an Open Source that was later renamed as Selenium core. 

Selenium Basic Terminology 

Before we start with this terminology, let us first understand a number of the principles connected with an application’s Automation research.

With the growing need for products related to software, each software development community requires to hold out a series of tests before the ultimate product is released into the market.

Test engineers aim to detect the errors or bugs before the software package is released, but there are often flaws within the delivered software. Also for the strongest manual verification procedures, there’s still a risk that the finished software package is going to be left with a flaw or that it’s not going to be ready to fulfill the user requirements.

Automation Testing 

Selenium Automation Testing uses the resources that are advanced to enhance achievement without any human interference. These testing tools access the test data, control the fulfillment of the real result and help Automation Testing relate the actual result against the anticipated result.

Selenium Automation Testing enfold (cover) Functional and Performance tests on web Application:- 

  • Regression tests which are repeated in nature, are automated mechanized. And this is the example of Functional Automation that is primarily used for the automation of functional test instances.
  • Automation of performance is employed to eliminate the non-functional output test cases. For eg, measure the application’s response time under reasonable load. 

Note:- Performance testing using Selenium and WebDriver is usually not advised. Not because it’s incapable, but because it’s not optimised for the work and you’re unlikely to urge good results.

Automation Testing tools that are pre-owned to Functional operations:- 

  • Auto It, open Source.
  • Unified Functional Testing (UFT)
  • Selenium, it’s Open Source 
  • Parasoft SOAtest 

Automation Testing tools which are pre-owned  for nonfunctioning  automation:

  • JMeter, by Apache
  • Loadster, 
  • Webserver Stress Tool
  • Acunetix, provided by Acunetix

Automation Test Life Cycle 

Why Automated Testing? 

Automated Testing has numerous advantages for improving the efficiency ability of a Software. The key benefits are as follows: 

  • Big software organizations often use  Automated Testing because it is very expensive and difficult for small countries to implement 
  • Manual Testing for all workflows, all negative scenarios, and fields, are time-consuming and expensive
  • Infinite Iterations are provided for test case execution
  • Less errors as compared to manual testing 
  • Automation testing supports constant regression testing 
  • Disciplined documentation provided for test cases.
  • Provides quick feedback to the developer 
  • Automated Testing can audiovisual (playback) pre-recorded and predefined actions

Test Automation for Web Applications

If we take a glance at the sort of software applications prevailing in the current market framework, most of the software applications are written as web-based applications to be run in an online browser. 

The testing strategy for web-based applications varies widely among companies and organisations. In a stage of highly interactive and responsive software processes where many organisations are using some sort of nimble procedure, test automation is usually becoming a requirement for software projects.

The most effective manner to hold out test automation for web applications is to adopt a pyramid testing strategy.

This pyramid testing scheme includes automation tests at three non-identical levels. 

  1. Unit testing represents the bottom and largest percentage of this test automation pyramid.
  2. service layer, or API testing. and eventually, 
  3. GUI tests sit at the highest. 

The pyramid looks something like this:

Features of Selenium

Selenium is gaining popularity because of its insane features like: 

  1. Selenium supports multiple browsers: Selenium supports multiple browsers like Google Chrome, Safari, Firefox, Opera, etc.  One can launch any browser by just giving simple commands. 
  2. Multiple Programming Languages Support: Selenium supports multiple programming languages for writing test scripts. It includes Java, python, “C#”, Perl, etc. 
  3.  Momentum(Speed) and execution: There is no need for an intermediate server as Selenium directly conveys with the browser. 
  4. Easy to Identify and use web elements: Locators in Webdriver helps in finding the web elements in web applications. This advantage is very easy for testers to implement. 
  5. Open Source and Portable : It is a major benefit that Selenium is Open-Source and portable. Selenium can be downloaded from its official site from
  6. Works On different Operating System : Selenium web driver scripts can work on different OS such as Linux, MAC, Chrome. 
  7. Simple Commands :Selenium has very simple commands to implement. It can be learnt easily. 
  8. Server Installation Not Required Selenium Web Driver is not required to Install a server, as it interacts directly with the browser.

Some More Key Features are:- 

  • Selenium Automation Tool requires very few tools as compared to other automation tools. 
  • Selenium can be desegregated with testing frameworks. 
  • Parallel test execution is also supported as that reduces time and increases the efficiency of tests. 
  • Pipelines Such as Continuous Integration and Continuous Delivery can be integrated with  Selenium. 
  • There are also many kinds of testing that can be automated using Selenium. Some are- Unit Testing, Regression Testing, Automated Browser Testing.
  • It is widely used in the web development domain. 

Limitations of Selenium 

  1. Selenium is only used for testing web applications not any software or GUI’s
  2. Mobile Automation can’t be done by Selenium itself. 
  3. Captchas are not automated using Selenium. 
  4. Inbuilt Reporting feature is not available in Selenium. 
  5. Selenium isn’t accurate in handling dynamic web pages. 
  6. Selenium faces some problems in handling frames and pop-ups. 
  7. Enormous timeout, sync, and page loading issues. 
  8. The irresponsibility of new features. They may work or may not. 
  9. Test Integration tool is not provided for Test Management. 
  10. Barcodes can’t be automated using Selenium. 
  11. Automation analysis can’t be performed on web services like SOAP Or REST. 
  12. Selenium can’t perform testing on images.
  13.  High skillsets are required for automating test tools.
  14. Selenium depends on Cucumber for reporting. 

Selenium Vs QTP 

Let us first learn a little bit about QTP.  

QTP (QuickTest Professional) is a Product of HP. This tool helps testers to perform automated functional testing seamlessly, without observing, once script development is complete. 

Now, let’s compare Selenium and QTP 

Selenium QTP 
Open source tool as it doesn’t require a license to be used  The commercial user-friendly tool as it requires a license and hence, is expensive. 
Various Environments are supported Like MAC, Linux, Windows, etc. Only One Supported “Windows”
Supports Automation Only for web Application. Supports Automation for web and desktop applications. 
Low Resource utilization during test Script Execution. High Resource Utilization. 
Multiple Supported Programming Languages like Java, Python, Perl, etc.Only One Supported Programming Language which is VB Script. 
Selenium has less functionality and hence takes much time to develop.QTP is Friendly with users and test scripts are quickly developed. 
Object Repository and Recovery Scenario is absent. Built-in Object repository and Recovery Scenario.  
Built-in tools are not available for parametrization. Built-in tools are available for parameterization.
Browser Controls are None. Controls Such as the favorites bar, forward buttons can access using the browser. 
It Requires External Tool For Giving Reports. Built tools are available for giving reports. 
Community Forums are available for Customer Support. Dedicated HP Support. 
Supported Browsers are chrome, safari, firefox, Yahoo, etc. Specific Version of Chrome, Firefox, Internet Explorer. 
Widely Range IDE Like VS Code, Eclipse, Netbeans. QTP tests can only be developed using QTP IDE. 
Automation Testing Using Selenium has less Cost.Automation Testing Using QTP has Expensive Costs due to its license costing.
Test Scripts Require To Be Updated.Backward Association is Powerful. 

 Key Differences Between QTP and Selenium are:- 

  • Selenium is Open-Source as it doesn’t require a License. Whereas, QTP requires license to be used 
  • Selenium is used for web applications. QTP can be used for web and desktop applications 
  • Selenium Automation tool costs less. Whereas, QTP is expensive 
  • Less functionality. Hence, takes so much time to develop and maintain. Test Scripts can be quickly done because of its user-friendly nature 
  • Selenium supports multiple programming languages. Whereas, QTP supports only one. 

Now let’s talk about IDE (Selenium Integrated Development) in-depth.   

IDE (Selenium Integrated Development)  

Selenium integrated tool is the easiest web automation tool present in the selenium suite. It is very easy to learn. 

It is an add-on of firefox so that tests are created quickly through its works and functionality. This feature is similar to QTP.

It is so simple, and thus, is only used for prototyping tools and not for developing complex test suites.

Even so, you will be able to use Selenium IDE as you don’t need any programming knowledge. Familiarity with Html, JavaScript, DOM is recommended if you wish to use IDE perfectly. 

Some knowledge of JavaScript is required for learning Selenese “runscript”.

When creating tests, Selenium supports autocomplete mode for the following purposes:

  • Helps to enter commands quickly.
  • Restricting users from entering the wrong command.


  • Selenium IDE only supports Firefox and Chrome plug-in, which means you are not able to record your test cases other than these two. But, it can be exported in multiple programming languages like Python, Perl,  Java, C#.

Selenium  IDE Installation 

As you all know, Selenium IDE is only in Mozilla Firefox and Chrome plug-in. So I assume that you had pre-installed firefox. If not, you can go to the link below and simply download it from here.

Steps For Downloading Selenium IDE and Installing it:- 

  • Launch your Installed Firefox browser. 
  • Click Here and You Will be Redirected to the page of firefox where you have to download it. 
  • Click add to Firefox 

  • A Popup Will Come then allow that and your Selenium IDE Has Installed 
  • Restart your browser 
  • Top right corner of your firefox browser and look for the Selenium IDE 
  • Click on That Icon and Your Selenium has been launched.
This is the Interface of Selenium IDE 

Now that we are done with the Selenium Installation, we are ready to move further ahead in this Selenium Tutorial. We now have all the tools that are required before learning more about Selenium IDE. 

Selenium IDE Features 

Selenium IDE has various components. Each component has its features for what they are designed. Given below is the diagram by categorizing its components. 

  1. Menu bar Component 
  2. Test Case Pane 
  3. Toolbar 
  4. Address bar 
  5. Test Script Editor box 
  6. Log, Reference Pane
  7. Stop and Start Button 
  1. Menu bar

Menu Bar is very handy when working with Selenium IDE. It is located at the topmost of the IDE Interface. 

  • Project Name 

You can Edit or Rename your project. 

  • Open Project 

If you have any personal project. 

  • Save Project 

You can save your existing project.

  • New Project 

If you want to make a new project, you can click on the new project icon. 

All the labeled diagrams are shown below.

Now. Let’s Talk About The Toolbar.  

  1. Toolbar 

All the execution of your test cases is controlled by the toolbar. It gives you a step feature of debugging your test scripts. The most commonly used modules for Toolbar are: 

  • Speed Control Option

It allows you to control the speed of execution of test cases.

  • Step Feature 

Step feature helps step into each specific command in the test script and it is used for debugging the test cases. 

  • Run Tests And Run All Tests 

Run test allows you to run the selected tests. Whereas, run all allows you to run all tests. 


ShortCut for Run Tests is Ctrl + R 

ShortCut For Run All Tests is Ctrl + Shift + R 

  1. Address Bar 

The current URL is shown in the address bar. When we click on the drop down, it displays all the previously visited websites as a part of automation. 

The below diagram shows the address bar in IDE.

  1. Test Case Pane 

Recorder modules by IDE are contained in this module. It is a list of recorded test cases by IDE. 

The selection of test cases from the test case can be done using the test case pane. 

  1. Test Script Editor Box 

As depicted within the diagram below, the Test Script Editor Box contains the user interactions that are recorded within the sort of Test Steps in Selenium IDE.

Each and every recorded test step contains values under the three columns i.e. Command, Target, and Value.

For example, if you record the typing of QAFox text into the search box field on the website.

The commands are going to be typed. The target is going to be the locator for locating the Search box field. The values are going to be the text that’s typed into the Search box field. 

  • Command 

Commands are often considered because of the actual operation/action that’s performed on the browser elements. For example, if you’re opening a replacement URL, the command is going to be ‘open’; if you’re clicking on a link or a button on the online page, then the commands are going to be ‘clicked’.

  • Target 

Target specifies the online element on which the operation has got to be performed alongside a locator attribute. 

  • Value 

Value is treated as an optional field and may be used once we get to send some actual parameters. As an example, if you’re entering the e-mail address or password during a textbox, then the worth will contain the particular credentials.

  1. Start/Stop Recording Button

It records all the user action to the browser. 

  1. Log, Reference Pane

The Log pane will display the runtime commentary/messages during the execution of the chosen test.

The reference pane will display the small print of the command within the currently selected test step within the Test Script Editor Box.

IDE First Test Case

In this part, you will learn to create a basic test case in your Selenium IDE. 

Given below are the three steps to follow to create your first test case: 

  1. Recording (Recording of browser interaction between the user) 
  2. Audiovisual (Playback) (The Recorded Script accomplishing)
  3. Liberate the test suites or save it

Let’s discuss each step in a detailed manner. 

  1. Recording 
  • Initiate(Start) your Firefox. 
  • There is the Selenium Icon at the top right-most, Click on that icon, and your Selenium IDE will be launched. Downloading and setting up is shown above. 
  • You will see the default interface as shown above. 
  • You can name the project as you wish to. I am renaming it as Great Learning Project.
  • Rename the test event as you wish. I will be naming it as Selenium Tuts. 
  • At the top right corner of the IDE, you will find Start/Stop Recording Tab, click on that to start recording your test case. 
  • Let me show you something interesting. Go to your firefox and search for the Great Learning blog and click on any particular blog of Great Learning. 
  • Make sure your recording tab is on in your IDE. 
  • Now, you will see all actions done by you in the selenium IDE being recorded. 
  • Now stop the recording in your Selenium IDE. 
  • And you will see all the browser interactions that you have done. 

2.Playing Back 

  • Click on the Run Current test tab as shown above that is present on the toolbar menu in your Selenium IDE. 
  • What it will do is that It executes all the interactivity with the browser and handover all the summary of the executed test script. 
  • The Log and Reference pane component displays all the summary of all the executed test scripts. 

3.liberate the test suites or save it

  • Click on the Save button at the rightmost of your Selenium IDE. 
  • Save as “Selenium Review”
  • The Saved Test Suite Extension is “SIDE”. 

Note:- If you are unfamiliar with the above topics like toolbar, recording button, etc, you will find the topic “SELENIUM IDE”. Start learning from there, and you will understand it all. 

Selenium-IDE Login test

In this part, we are going to do a Login Test in Selenium IDE. For educational purposes, we will use the Joodle Website for Testing. You can find that particular URL:- . Go to this site. 

The default look of this website is something like this: 

This is the default look. Now, let us start learning. 

Firstly, we have to register here, and then we will sign up. Now we are going to create a test script for login/sign-up in Selenium IDE.

The steps to be followed are given below:


  1. Open your Firefox Browser. 
  2. At the top right corner, you will find the Selenium icon, hit on that. Now your Selenium IDE is Launched. 
  3. Go to the Firefox browser and then go this URL:-
  4. Enter the project name as –Login_Test 
  5. Enter the Test Event name as- First_Test
  6. Now click on the start recording button to keep track of all action done by the user.
  7. Go to your firefox browser and right-click and select the Selenium IDE Option. 
  8. Then select the assert title. This prescribes that your title is correct. 
  9. Click on the Sign-up Button to sign up with your email. 
  10.  After Signing-up, you will get an email to activate click on activate. Now you are done. 
  11.  Now go to the login section. You will have to fill in your provided credentials. 
  12. This website provides an online text editor and compiler for multiple languages. 
  13.  Click on any programming language you want. 
  14.  Go back to your profile and then logout from there.
  15.  Go to your Selenium IDE Interface, click on stop recording. 

Playing back 

  1. Click on The “Run Current Test Tab”. The Actions by browsers are executed and then it gives the overall summary of the test scripts. 

    2 . The Execution process of all the execution tests are displayed on the log pane. 

Save Project:- 

  1. Click on the save project button. 
  2. Save the project whatever you want to name it. 
  3. In the future, if you want to work on this project you can go to the open project option. 

Selenium IDE- Commands (Selenese)

Selenium commands also referred to as Selenese is the place of commands implemented in Selenium IDE that run your tests. A sequence of Selenium commands (Selenese) together is understood as a test script. Using Selenese, one can perform activities like:

Testing the existence of UI elements supported their HTML tags.

Testing is done for specific content.

Testing is done for broken links. Assessing the window size, mouse options, alerts, Ajax functionality, pop-up windows, event handling, and much more.

Note: Test Scripts are the sequence of Selenium Commands or Selenese. 

Simplicity commands are classified into different types, let’s see. 

Types of Selenium Commands: 

Primarily there are three types of commands that are classified in Selenium IDE: 

  1. Actions 
  2. Accessors
  3. Assertions 

Now, in these three types, there are several commands that we are going to see. 

  1. Actions 

The state of application is generally manipulated from the Actions Commands in Selenium IDE. 

Some of the most frequently used Actions Commands are given below: 

Commands Description Arguments 

click at
The coordinates are correlative to the target element and it clicks on the target element and they are used to check effects. Locators coord string
open  In This Case, it opens the URL and the URL is accepted is both relative and absolute URLsURLs 
type  It Sets the value of an input field, as you typed it in. Also Used to set values for combo boxes. locator, value
typeKeys Keystroke events are simulated on the specified element. locator, value
doubleClick dual Click on an element. locator 
focus moves the focus to the specific element locator
highlight background colors are changed to yellow of a particular element. locator
close It Closes one window, no need to close the initial window. 
storeEasy reuse, it saves the target string text, variable name
waitForConditionIt Evaluates to “true” until and unless the specified javascript executes. script, timeout
  1.  Accessors

Accessors are the selenium IDE commands that inspect the application state and the result in variables is stored. They also automatically generate assertions. 

Commands Description Arguments 
store title Gets the title of the current page. text, variable name
storeValue It Gets the value of an element and they are kept for future use. locators,  variable name
storeTable This Command Extracts the text from the cell of the table.tableCellAddress, variableName
storeAllFields ID’s of all the input fields are returned. variableName
storeAllLinks It returns the ID’s all the links. variable Name 
storeTextThis Command gets the text from an element and stores it for future use.  locator, variable name
storeLocation  This command gets the absolute URL of the particular page. variableName 
storeBodyTextThis Command gets the entire text from the current page. variableName
storeAllButtons ID’s of All The Buttons are returned. variableName
storeElementIndex It Gets the relative of an element starting from 0 to its parent. locator, variableName
  1. Assertions 

Assertions commands are generally used for authorizing testers to substantiate the state of the Application. 

Some of the widely used commands in selenium IDE are given below: 

Commands Description Arguments 
verifySelectedThis Command confirms that the chosen option of a drop-down persuades the option specifies. selectLocator, optionLocator
verifyAllLinks This command confirms all the links used with the  accessorstoreAllLinks.pattern
verifyAlert This  Command confirms the Alerttext; used with accessorstoreAlert.pattern
verifyBodyTextThis Command Confirms the body text used with some commands pattern
verifyAttributeThis Command confirms the features of an element used with the accessorstoreAttribute.attributeLocator, pattern
verifyAllWindowIdsThis Command confirms the windows id.   pattern
waitForAlert This Command authorizes the wait of alerts; used with accessorstoreAlert.pattern
waitForErrorOnNext This Command authorizes wait of errors; used with Accessors Message 

IDE Locating Strategies

Before directly going to Llcating strategies, let’s first understand what Locators are.

Locators in commands tell the Selenium IDE which GUI (Graphical User Interface) component to work on.

The prerequisite for creating automation scripts is choosing the correct GUI (Graphical User Interface) component which can include Text Box, Buttons, Check Boxes, etc. 

But choosing the precise recognition of GUI Components is more difficult as it sounds. 

Consequently, Selenium Provides several locators to accurately locate GUI components. Different types of locating strategies are given below: 

  • Locating by ID
  • Locating by Name 
  • Locating by Identifier
  • Locating by XPath Expressions 
  • Locating by CSS Selectors 
  • Locating by DOM  (Document Object Model)
  1.  Locating by ID 

Locating by ID is the most frequent method of locating elements. But IDs are supposed to be unique. 

Let us consider an example related to locating by identifier.  

As we had done before, we will create a login test to understand it better. 

Steps to be followed below: 

  • Open Firefox Browser 
  • Click on the particular selenium icon on the top right of most of your browser. 
  • It will launch your Selenium IDE
  • Click on the command tab present in the Text Editor. 
  • Recast it to the possession of the first command as:- 
  1. Command: open
  2. Target:
  3. Execute It. 

After Execution, your program will look like:- 

To enter the second command, we need some identification for the username text box which would serve the IDE to recognize the target location.

  • Right-click on your mouse with hand over to the username and select inspect element. 
  • The Codes will be launched contained in the production of username text box. 
  • Select the Component with the matching name feature that contains the precise name for the “Username” text box.
  • Recast it to the possession of the first command as:- 
  1. Command: click at
  2. Target: id=login
  3. Execute it. 
  • Recast it to the possession of the first command as:- 
  1. Command: type
  2. Target: id=login1
  3. Value: username
  4. Execute it. 

Now we will go through with password

  • Right-click on your password text box and click on inspect element. 
  • Again containing codes at the bottom. 
  • Select the component with the matching name feature that contains the precise name for the “Password” text box. 
  • Recast it to the possession of the first command as:- 
  1. Command: click at
  2. Target: id=password
  3. Execute it. 
  • Recast it to the possession of the first command as:- 
  1. Command: type
  2. Target : id=password
  3. Value : *********
  • Now, Right Click on “sign-in” and select inspect element.
  •  Recast it to the possession of the first command as:- 
  1. Command: click at
  2. Target : id=proceed
  3. Execute it. 
  • Now, at last Click on the run current test tab which will execute your scripts.
  • The log pane summarizes it. 

Format of a Target: name=name of the element

  1. Locating by Identifier 

Locating by identifier contains both locating strategies like Locating by Name and ID. 

  • The identifier was applied as a welshed(default) type previously but now it is not endorsed now as it is not reinforced by the web driver. 
  • With identifiers, we will use a locating approach like ID and name both. 
  • The starting element with the matching ID feature is employed.
  • If no element features a matching ID attribute then the primary element with an identical name attribute is employed.
  • For instance: Identifier=login (this might be ID or Name)

Let us consider an example related to locating by identifier:  

As we had done before, we will create a login test to understand it better. 

Steps to be followed below: 

  • Open Firefox Browser 
  • Click on the particular selenium icon on the top right of most of your browser. 
  • It will launch your Selenium IDE
  • Click on the command tab present in the Text Editor 
  • Recast it to the possession of the first command as: 
  1. Command: open
  2. Target:
  3. Execute It. 

After Execution, your program will look like:- 

To enter the second command, we need some identification for the username text box which would serve the ide to recognize the target location.

  • Right-click on your mouse with hand over to the username and select inspect element. 
  • The codes will be launched contained in the production of the username text box. 
  • Select the Component with the matching name feature that contains the precise name for the “Username” text box.
  • Recast it to the possession of the first command as:- 
  1. Command: click at
  2. Target: name=login
  3. Execute it. 

Now we will go through with password:

  • Right-click on your password text box and click on Inspect Element. 
  • Again Containing Codes at the bottom. 
  • Select the Component with the matching name feature that contains the precise name for the “Password” text box. 
  • Recast it to the possession of the first command as:- 
  1. Command: click at
  2. Target: name=password
  3. Execute it. 
  • Recast it to the possession of the first command as:- 
  1. Command: click at
  2. Target: name=login
  3. value: username (whatever you want)
  4. Execute it. 
  • Recast it to the possession of first command as:- 
  1. Command : type
  2. Target : name=passwd
  3. Value : **********(User Login Password)
  • Now, Right Click on “signin” and select inspect element.
  •  Recast it to the possession of the first command as:- 
  1. Command: click at
  2. Target : name=proceed
  3. Execute it. 
  • Now, at last, Click on the run current test tab which will execute your scripts.
  • The log pane summarizes it. 

  1. Locating by Name

Locating by name is very related to Locating by ID, but only the exception is that it uses the “name” prefix instead. 

The name locator type will locate the primary element with an identical name attribute.

Locating By Name is Syntax is Same as Locating by Identifier. All the procedures are the same.

  1. Locating by XPath Expressions 
  • XPath may be a language used for locating nodes in XML documents.
  • XPath is often used as a replacement once you do not have an appropriate id or name attribute for the element you would like to locate.

XPath provides locating plans like:

  • XPath Absolute
  • XPath Attributes

XPath Absolute (not recommended)

  • XPath Absolute enables users to say the entire XPath location from the basis HTML tag to the precise components.
  • It is not recommended because it takes the entire XPath location and if the situation of the online element is modified or it belongs to another parent then XPath is going to be unable to locate the particular component.

rules : //html/body/tag1[index]/tag2[index]/…/tagN[index]

Example: //html/body/div[2]/div/div[2]/div/div/div/fieldset/form/div[1]/input[1]

XPath Attributes

  • XPath Attributes are usually recommended once you do not have an appropriate id or name attribute for the element you would like to locate.

Syntax: //htmltag[@attribute1=’value1′ and @attribute2=’value2′]

Example: //input[@id=’passwd’ and @placeholder=’password’]

Locating by XPath Expressions is used when locating XML (Extensible Markup Language) Nodes. Since HTML elements can be convinced of XML, XML Expressions can also be used in locating HTML Elements. 

Pros:  It can access almost any element, even those that are present without class, name, or ID’s Features. 

Cons:-  The biggest disadvantage is that it is more complicated because of its hard rules and considerations.

  1. Locating by CSS Selectors  

They are the string patterns used to recognize a component based on the combination of HTML tag, ID, class, and features. It is commonly used with Selenium Advanced users as it can even access those elements without ID or Name. 

There are many formats in CSS Selectors Some are:- 

  • Locating by ID
  • Locating by Class
  • Locating by Attribute
  • Locating by ID/Class & Attribute

Let’s Take a Loot at Locating by ID. 

Rules:-  css=<HTML tag><#><Value of ID attribute>. 

Note:- ‘#’ symbol is used to represent the attribute of ID.

Steps to be followed below: 

  • Open Firefox Browser 
  • Click on the particular selenium icon on the top right of most of your browser. 
  • It will launch your Selenium IDE
  • Click on the command tab present in the Text Editor. 
  • Recast it to the possession of the first command as: 
  • Right Click on it and choose to inspect elements. 
  • Codes will appear at the bottom of the website. 
  • Recast it to the possession of the first command as: 
    • Command: click at
    • Target: css=input#email 
    • Execute it 
  • instructions will type the value in the “Username” text box.
  • Lastly click on “Run Current Test”, after that your test will be executed and the log pane displays the overall summary of your test scripts. 

  1. Locating by DOM  (Document Object Model)

The DOM (The Document Object Model)

The Document Object Model (DOM), in straightforward terms, is the way by which HTML elements are organized. Selenium IDE is in a position to use the Document Object Model in accessing page elements. 

If we use this technique, our target box will always initiate with “dom=document…”;

However, the “dom=” designation is usually removed because Selenium IDE is in a position to impulsively illuminate anything that executes with the key “document” to be a path within the DOM regardless.

There are four primitive way to locate a component through DOM:- 

  • dom:index 
  • dom:name 
  • getElementById 
  • getElementsByName 
  1. dom:index 
  • Format:- document.forms[index of the form].elements[index of the element]
  • Index of the form:- Starting from 0 indexes and the type is the integer
  • Element Index:- The value of an integer with respect to the whole form contains it and starting from 0.
  1. dom:name 

Format: document.forms[“name of the form”].elements[“name of the element”]

Name of the shape – it’s the worth of the name attribute of the shape tag that contains the element you would like to access.

Name of the element – it’s the worth of the name attribute of the element you would like to access.

Example: “document.forms[“home”].elements[“userName”]”

  1. getElementsByName

Format:- document.getElementByName(“name”)[index] Name

Index:- The Location of a crave component 

  1. getElementByID 

Format:-  document.getElementById(“element id”)

Elements ID:- The Result of an ID Attribute is being retrieved. 

Selenium Web driver

Selenium Webdriver is an open-source assemblage of API’s and it is the most important component of Selenium Tool’s  Suite. It is used for testing web applications. Webdriver API is integrated with the latest release of selenium which is “Selenium 2.0”  provided with a simpler and a condensed programming look. 

Test Scripts in Selenium Webdriver can be developed with any supported programming language and can be executed in any modern or fancy browsers. 

Language Supported are: 

  1. C# 
  2. Python
  3. Perl 
  4. Java 
  5. Ruby
  6. .NET
  7. PHP 

You don’t have to know them all, but basic knowledge is always helpful. Currently, the most used programming language for Selenium Web Driver is Java and C#. 

Selenium web driver Architecture is uncomplicated than Selenium RC. Selenium Web Driver makes direct contact with the web browsers as it is much faster than Selenium RC. 

Selenium Web Driver Supports the following browsers: 

  1. Firefox
  2. Chrome 
  3. Safari 
  4. Internet Explorer 

Cross-browser testing is permitted.

Selenium WebDriver- Architecture

Selenium Web Driver is much simpler than Selenium RC. 

  • It powers the browser from the Operating System level
  • The only thing you need is the programming languages IDE 

In Selenium RC, it is more complicated.

There are primitively four basic components of WebDriver Architecture: 

  1. Selenium Language Bindings 
  2. JSON Wire Protocol 
  3. Browser Drivers 
  4. Real Browsers 

Selenium Language Bindings 

All supported programming languages are built-in by the language bindings. Let’s say you want to work with java, for working with java, you have to install Java bindings and likewise, they can be installed. 

You can download all the bindings from this URL:

JSON Wire Protocol

JSON today is one of the foremost widely used and accepted methods for the communication of heterogeneous systems. JSON has employed tons of web services in REST and has been a robust competition for XML.

Let’s understand how Web driver uses it when testing the online applications −

WebDriver uses JSON as a medium to speak between client libraries (Java, C#, Python than on) and drivers (Firefox Driver, IE Driver, Chrome Driver). The request is within the form of an HTTP request which accepts input within the sort of JSON. The operations are performed, and therefore, the response of execution is shared back to the client within the sort of JSON. 

Similarly, the RemoteWebDriver client and therefore the RemoteWebDriver server use the JSON wire protocol to speak among themselves.

To sum up, let’s examine how it works in a step by step manner −

In a server-client architecture, the client and server must be in sync and are ready to receive and send the request and response.

The server doesn’t understand the programming language during which the program is made, it just understands the protocol, and here comes the role of JSON Wire Protocol.

It uses the method of serialization (convert Object’s data to JSON Format) and de-serialization (convert JSON format to object) a bit like REST web services.

Browser Drivers

Drivers are specific to particular browsers to set up a secure connection to the browser and all actions are performed internally. The browser driver is specific to the particular language used for automation such as Java, C#, etc. 

Operations that are performed internally while execution of test script using WebDriver: 

  • For each Selenium Command, an HTTP request is generated and sent to the browser. 
  • The Driver acquires the HTTP request along with HTTP Server. 
  • The server determines all the steps to accomplish commandment which are executed on the browser. 
  • After this, the execution status is followed back to HTTP Server. 


The Browser Supported By WebDriver are:

  1. Internet Explorer 
  2. Firefox 
  3. Opera 
  4. Safari 

Selenium WebDriver- Features

Some of The Most Important Features: 

  1. Multiple Browser Support:  Selenium WebDriver Supports Multiple Browsers such as Firefox, Opera, Safari, Internet Explorer and many more. 
  2. Speed: WebDriver Performs much faster than Selenium Remote Control. 
  3. Simple Commands: Selenium WebDriver Uses Simple Commands That are easier to Learn and Implement.
  4. WebDriver- Methods, and Classes.

What is Selenium Grid?

Selenium Grid may be a smart proxy server that creates easy to run tests in parallel on multiple machines. This is often done by routing commands to remote browser instances, where one server acts as the hub. This hub routes test commands that are in JSON format to multiple registered Grid nodes.

Hub conducts a multiprogramming of tests on multiple machines, managing different browsers centrally, rather than conducting different tests for every one of them. Selenium Grid makes cross-browser testing easy as one test is often carried on multiple machines and browsers, all at once, making it easy to research and compare the results.

The two major components of Selenium Grid are:

Hub may be a server that accepts the access requests from the WebDriver client, routing the JSON test commands to the remote drives on nodes. It takes instructions from the client and executes them remotely on the varied nodes in parallel.

The node may be a remote device that consists of a native OS and a foreign WebDriver. It receives requests from the hub within the sort of JSON test commands and executes them using WebDriver.

Why Selenium Grid?

Selenium Grid is useful for different reasons are as follows: 

  1. Run on different platforms 
  2. Parallel Execution 

When to use Selenium Grid? 

  • To run tests on multiple browsers 
  • To reduce the time 


From the above Selenium Tutorial, it is proved that Selenium is one of the best Automation tools and it is open-source. Selenium provides various components to easily come up with tasks.

I hope that you found this Selenium Tutorial enjoyable and interesting. And I hope that it helped you in learning Selenium in-depth. If you found this blog on Selenium Tutorial helpful, you can check out the various courses that Great Learning Academy offers, and learn more such skills.

This brings us to the end of the blog on Octave Tutorial. We hope that you found this helpful and were able to learn more about the concepts. If you wish to learn more such skills, join Great Learning Academy’s pool of Free Online Courses!

Whether it is Data Science, Machine Learning, or Coding, find a course for yourself and earn a free certificate.



Please enter your comment!
Please enter your name here

one × 5 =