• What is Automation Testing - Advantages & Types of Tools
  • What is Selenium IDE, Selenium RC, Selenium WebDriver, Selenium Grid?
  • Selenium IDE, Firebug & Firepath Installation


  • Selenium WebDriver Architecture
  • Selenium Installation
  • Challenges and Limitations of Selenium
  • First Selenium WebDriver Script
  • Working with Firefox Browser
  • Solution - Failed To Launch Browser Using Selenium WebDriver
  • Working with Chrome Browser
  • Working with IE Browser
  • Difference Between FindElement & FindElements
  • Install Firebug, Fire path and other add on for Selenium
  • Locators in Selenium
  • Dynamic Xpath
  • Dynamic CSS
  • Handle drop-downs
  • How to work with file upload
  • Handle Alerts & Popups
  • Handle Multiple Windows
  • Mouse Hover event in Selenium
  • Right Click
  • Double Click
  • Drag and Drop
  • Capture Screenshots in Selenium
  • Parameterization
  • Synchronization
  • Implicit Wait, Explicit Wait and Fluent Wait in Selenium
  • Implicit Waits
  • Explicit WebDriver Waits
  • Fluent Wait In Selenium
  • Apache POI
  • How To Read Data From Excel File
  • How To Write Data In Excel File
  • Database Testing Using MSSQL
  • Database Testing Using MySQL
  • Database Testing Using DB2
  • Handle Ajax Call in Selenium
  • Listeners in Selenium
  • Handling JavaScript in Selenium
  • Stale Element Reference Exception in Selenium
  • Integrate Sikuli with Selenium
  • Headless Browser Testing 
  • Headless Browser Testing using HtmlUnitDriver
  • Headless Browser Testing using PhanthomJSDriver


  • TestNG Installation
  • TestNG Complete Tutorial


  • Extent Reports Introduction
  • Extent Reports Generation
  • Capturing Screenshots & Including In Extent Reports
  • Extent Reports Version 4


  • ANT Build Tool - How To Download & Install
  • Maven Build Tool - How To Download & Install
  • Creating Maven Selenium Project
  • GIT Integration with Selenium
  • Jenkins - How To Download & Install
  • Jenkins - Executing TestNG Scripts
  • Jenkins - Generating Reports After Test Execution
  • Jenkins - Executing Maven Project
  • Create build and Execute build for nightly execution
  • Send Email report based on build Status
  • Selenium Continuous Integration with Jenkins [Selenium – Maven – Git – Jenkins] – Step By Step Guide


  • Running Selenium Tests On BrowserStack
  • Kobiton - Mobile Testing Platform with Real Devices


  • Mobile Testing Platform with Real Devices


  • What is Framework & Types of Framework
  • Page Object Model Design Pattern
  • Data Driven Framework
  • How to explain Test Automation Framework or Selenium Automation Framework Architecture In Interview

  • API Testing:

  • Learn API Testing
  • Postman Tutorial (API Testing with Postman)


  • Test Automation Framework Interview Questions
  • Selenium Interview Questions
  • TestNG Interview Questions
  • Java Interview Questions
  • Python Interview Questions
  • API Testing Interview Questions


  • Automation Tester Resume
  • Locators in Selenium WebDriver | Selenium Tutorial

    Locators in Selenium – Before going ahead, I assume you have already gone through the installation of FireBug and FirePath. If not, check out the link mentioned below:

    How To Install Fire Bug, Fire Path

    We use FireBug and FirePath to identify the Locators in Selenium

    Hope you have already installed Selenium WebDriver. If not go through the below mentioned link to download and install Selenium WebDriver.

    How To Download And Install Selenium WebDriver

    Selenium identifies the elements to be worked on using the following locators.

    Different types of Locators in Selenium are as follows:

    i. ID
    ii. Name
    iii. Class Name
    iv. Tag Name
    v. Link Text & Partial Link Text
    vi. CSS Selector
    vii. XPath

    Locating elements in WebDriver is done by using the method “findElement(By.locator())“.

    We use above mentioned method to locate elements but the locator() part will be replaced with the locator names. Mentioned few examples below for reference.

    Here is the link to the post “Difference between findElement and findElements methods

    Let’s see each of the Locators in Selenium in detail:

    ID Locator:

    ID’s are unique for each element so it is common way to locate elements using ID Locator. As per W3C, ID’s are supposed to be unique on a page and it makes ID’s are the most reliable locator. ID locators are the fastest and safest locators out of all locators.

    id = id of the element

    Click this link for detailed explanation of ID Locator

    Name Locator:

    We sometimes use Name locator to identify the elements on our webpage. Locating elements using Name is same as locating elements using ID locator.

    These are not unique on a page. If there are multiple elements with the same Name locator then the first element on the page is selected. Test may fail, if another element with the same Name locator is present on the web page or added by the developers in the later stages.

    Name = Name of the element

    Click this link for detailed explanation of Name Locator

    Class Name Locator:

    Class Name locator gives the element which matches the values specified in the attribute name “class”.

    Click this link for detailed explanation of Class Name Locator

    Tag Name Locator:

    Tag Name locator is used to find the elements matching the specified Tag Name. It is very helpful when we want to extract the content within a Tag.

    Click this link for detailed explanation of Tag Name Locator

    Link Text Locator:

    If there are multiple elements with the same link text then the first one will be selected. This Link Text locator works only on links (hyperlinks) so it is called as Link Text locator.

    Click this link for detailed explanation of Link Text Locator

    Partial Link Text:

    In some situations, we may need to find links by a portion of the text in a Link Text element. it contains. In such situations, we use Partial Link Text to locate elements.

    Click this link for detailed explanation of Partial Link Text Locator

    CSS Selector Locator:

    There is a debate on the performance between CSS Locator and XPath locator and the debate on the performance of CSS and XPath locator is out of scope of this post. Most of the automation testers believe that using CSS selector makes the execution of script faster compared to XPath locator. This locator is always the best way to locate elements on the page.

    Following are the some of the mainly used formats of CSS Selectors.

    • Tag and ID
    • Tag and Class
    • Tag and Attribute
    • Tag, Class and Attribute

    Click this link for detailed explanation of CSS Selector Locator

    XPath Locator:

    XPath is designed to allow the navigation of XML documents, with the purpose of selecting individual elements, attributes, or some other part of an XML document for specific processing. XPath produces reliable locators but in performance wise it is slower (especially in IE older versions) compared to CSS Selector.

    Click this link for detailed explanation of XPath Locator

    Locators in Selenium WebDriver

    Get our latest blog posts delivered to your inbox

    Subscribe and get popular blog posts about software testing industry.


    Leave a Comment

    Share via
    Copy link
    Powered by Social Snap