Selenium IDE- Locating Strategies by Identifier and By Id

Last updated on Dec 02 2021
Manikaran Reddy

Table of Contents

Selenium IDE- Locating Strategies by Identifier and By Id

For most of the Selenium commands, we’d like a target location which uniquely defines the online element within the context of an internet application.
A target consists of a locating strategy and features a format like:
1. LocatorType = LocatorStrategy
In Selenium IDE, a target works on six modes of specifying location of a specific web element which are:
• Locating by Identifier
• Locating by ID Element
• Locating by Name
• Locating by XPath
• Locating by CSS
• Locating by DOM

Selenium Web Driver
Selenium Web Driver

Selenium IDE- Locating Strategies (By Identifier)

• Identifier was used as a default type earlier and not recommended now as it isn’t supported by WebDriver.
• With identifier, we will use locating strategies like ID and Name both.
• The first element with the matching ID attribute is employed .
• If no element features a matching ID attribute then the primary element with an identical name attribute is employed .
• For example, Identifier=login (this might be ID or Name).
Let us consider an example on the way to use Identifier locator as a target for commands in Selenium IDE.
We will create a login test, in order that you’ll get a far better understanding of locating elements through Identifier.
• Launch Firefox browser.
• Click on the Selenium icon present on the highest right corner on your browser.
• It will launch the default interface of Selenium IDE.
• Click on the command text box present on the Test Script Editor Box.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of first command as:
o Command: open
o Target:https://mail.rediff.com/cgi-bin/login.cgi
o After execution, this command will load the Rediff login page on your Firefox browser.

Selenium Web Driver
Selenium Web Driver

For second command to be entered, we’d like a singular identification element for the Username text box which can help the IDE to spot the target location.

o Right click on the “Username” text box and choose Inspect Element.

Selenium Web Driver
Selenium Web Driver


o It will launch a window containing all the precise codes involved within the development of the “Username” text box.

Selenium Web Driver
Selenium Web Driver


o Pick the primary element with the matching ID attribute that contains the precise ID for the “Username” text box.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of second command as:
o Command: click at
o Target: identifier=login1
o After execution, this command will click on the Username text box.

Selenium Web Driver
Selenium Web Driver

We will use an equivalent identifier element for our next command.
• Modify the properties of third command as:
o Command: type
o Target: identifier=login1
o Value: username
o After execution, this command will type the username within the Username text box.

Selenium Web Driver
Selenium Web Driver

We will now add a command which will click on the “Password” text box. For this command, we’d like a singular identification for the “Password” field which can help the IDE to spot the target location.

o Right click on the “Password” text box and choose Inspect Element.

Selenium Web Driver
Selenium Web Driver


o It will launch a window containing all the precise codes involved within the development of the “Password” text box.

Selenium Web Driver
Selenium Web Driver


o Pick the primary element with the matching ID attribute that contains the precise ID for the “Password” text box.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of fourth command as:
o Command : click at
o Target : identifier=password
o After execution, this command will click on the Password text box.

Selenium Web Driver
Selenium Web Driver

We will use an equivalent ID element for our next command which involves typing the password as login credential.
• Modify the properties of fifth command as:
o Command : type
o Target : identifier=password
o Value : **********(User Login Password)
o Upon execution this command will type the user password because the login credential.

Selenium Web Driver
Selenium Web Driver

At last, we’d like a singular identification element for the Login Submit button which can help the IDE to spot the target location.

o Right click on the “Go” button and choose Inspect Element.

Selenium Web Driver
Selenium Web Driver


o It will launch a window containing all the precise codes involved within the development of the “Go” submit button.

Selenium Web Driver
Selenium Web Driver


o Pick the primary element with the matching name attribute that contains the precise name for the “Go” submit button.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of sixth command as:
o Command : click at
o Target : identifier=proceed
o After execution, this command will click on the “Go” submit button.

Selenium Web Driver
Selenium Web Driver

• Click on the “Run Current Test” button present on the tool bar menu of the IDE. it’ll execute all of your inserted commands on the browser and provides you an overall summary of the executed test script.
• The Log pane displays the general summary of the executed test scripts.

Selenium Web Driver
Selenium Web Driver

Thus, you’ll see that we’ve used identifier locator as a target for many of our Selenium commands.

Selenium IDE- Locating Strategies (By Id)

• This sort of locator is more explicit and therefore the first element with the matching id attribute is employed .
• It is employed only you recognize an element’s id attribute.
• For example, id=login.
Let us consider an example on the way to use Id locator as a target for commands in Selenium IDE.
We will create a login test, in order that you’ll get a far better understanding of locating elements through Id locator.
• Launch Firefox browser.
• Click on the Selenium icon present on the highest right corner on your browser.
• It will launch the default interface of Selenium IDE.
• Click on the command text box present on the Test Script Editor Box.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of first command as:
o Command: open
o Target:https://mail.rediff.com/cgi-bin/login.cgi
o Upon execution this command will load the Rediff login page on your Firefox browser.

Selenium Web Driver
Selenium Web Driver

For second command to be entered, we’d like a singular identification element for the Username text box which can help the IDE to spot the target location.

o Right click on the “Username” text box and choose Inspect Element.

Selenium Web Driver
Selenium Web Driver


o It will launch a window containing all the precise codes involved within the development of the “Username” text box.

Selenium Web Driver
Selenium Web Driver


o Pick the primary element with the matching ID attribute that contains the precise ID for the “Username” text box.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of second command as:
o Command: click at
o Target: id=login1
o Upon execution this command will click on the Username text box.

Selenium Web Driver
Selenium Web Driver

We will use an equivalent id element for our next command.
• Modify the properties of third command as:
o Command: type
o Target: id=login1
o Value: username
o After execution this command will type the username within the Username text box.

Selenium Web Driver
Selenium Web Driver

We will now add a command which will click on the “Password” text box. For this command, we’d like a singular identification for the “Password” field which can help the IDE to spot the target location.

o Right click on the “Password” text box and choose Inspect Element.

Selenium Web Driver
Selenium Web Driver


o It will launch a window containing all the precise codes involved within the development of the “Password” text box.

Selenium Web Driver
Selenium Web Driver


o Pick the primary element with the matching ID attribute that contains the precise ID for the “Password” text box.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of fourth command as:
o Command : click at
o Target : id=password
o After execution, this command will click on the Password text box.

Selenium Web Driver
Selenium Web Driver

We will use an equivalent ID element for our next command which involves typing the password as login credential.
• Modify the properties of fifth command as:
o Command : type
o Target : id=password
o Value : **********(User Login Password)
o After execution, this command will type the user password because the login credential.

Selenium Web Driver
Selenium Web Driver

At last, we’d like a singular identification element for the Login Submit button which can help the IDE to spot the target location.

o Right click on the “Go” button and choose Inspect Element.

Selenium Web Driver
Selenium Web Driver


o It will launch a window containing all the precise codes involved within the development of the “Go” submit button.

Selenium Web Driver
Selenium Web Driver


o Pick the primary element with the matching name attribute that contains the precise name for the “Go” submit button.
o Here, we do not find any matching id attribute so we’ve to use the Name locator to locate the “Go” submit button.

Selenium Web Driver
Selenium Web Driver

• Modify the properties of sixth command as:
o Command : click at
o Target : name=proceed
o Upon execution this command will click on the “Go” submit button.

Selenium Web Driver
Selenium Web Driver

• Click on the “Run Current Test” button present on the tool bar menu of the IDE. it’ll execute all of your inserted commands on the browser and provides you an overall summary of the executed test script.
• The Log pane displays the general summary of the executed test scripts.

Selenium Web Driver
Selenium Web Driver

Thus, you’ll see that we’ve used id locator as a target for many of our Selenium commands.
So, this brings us to the end of blog. This Tecklearn ‘Selenium IDE- Locating Strategies by Identifier and by Id’ blog helps you with commonly asked questions if you are looking out for a job in Selenium and Automation Testing. If you wish to learn Selenium and build a career in Automation Testing domain, then check out our interactive, Selenium Certification Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/selenium-training-certification/

Selenium Certification Training

About the Course

Tecklearn’s Selenium Certification Training enables you to master the complete Selenium suite. The Selenium Training is designed to train developers and manual testers to learn how to automate web applications with a robust framework, and integrate it within the DevOps processes of an organization. This Selenium Certification Training will also help you master important concepts such as TestNG, Selenium IDE, Selenium Grid, Selenium WebDriver, etc. Get hands-on experience on widely used automation frameworks such as Data-Driven Framework, Keyword-Driven Framework, Hybrid Framework, and Behavior Driven Development (BDD) Framework. Throughout this online Instructor-led Selenium Certification Training, you will be working on real-life industry use cases.

Why Should you take Selenium Certification Training?

• The average salary of a Selenium Test Automation Engineer is $94k per year – Indeed.com.
• Automation Testing Market is expected to grow at a Compound Annual Growth Rate (CAGR) of 18.0% in the next three years.
• Global software testing market to reach $50 billion by 2020 – NASSCOM. Selenium tool supports more browsers and languages than any other testing tool.

What you will Learn in this Course?

Getting started with Selenium
• Introduction to Selenium testing
• Significance of automation testing
• Comparison of Manual and Automation Testing
• Installation of Java JDK, JRE and Eclipse
Setting the environment in Eclipse for Selenium
• Java Introduction
• Creating a Java function and executing
• Concepts of Java
• Properties File
• Reading Data from Excel File
• Database Connection
• Hands On
Advantages of Selenium automation testing
• Selenium Features
• Concept of Selenium Integrated Development Environment
• Understanding of the Selenium IDE features
• Addition of Script assertions and general commands
• Deploying the first Selenium Script
• Sample project IDE
• Recording Selenium test case
• Hands On
Selenium Web driver Automation
• Architecture of Selenium Web Driver
• Download and installation
• Creating a Java function using Selenium and execution
• Hands On
Deploying Web Drivers for scripting
• Getting the HTML source of Web Element
• Table and Form Elements
• Firebug extension and Fire Path installation
• Advance User Interactions and Cross Browser Testing
• Hands On
Deep dive into Selenium Web Driver
• Action Commands
• Web Table / Date Picker
• How to Implement Switching Commands in WebDriver
• Alerts
• Frames
• Hands On
Switching Operations in WebDriver using Window
• Selenium Webdriver Wait
• Implicit wait, Explicit wait
• Deploying searching elements using the link text, name, using XPath
• Calendar
• Hands On
Introduction to TestNG Framework
• Introduction to TestNG
• Advantages of TestNG
• Installing TestNG on Eclipse
• Rules to write TestNG
• TestNG Features
• Annotations
• Grouping
• Sequencing: Prioritization and Dependency
• Enable/Disable a test case
• Parameterization: Using Xml file and DataProvider
• Parallel Testing & Cross Browser Testing
• TestNG Report: HTML Report, Console Report, XML Report
JUnit Operations and Test Framework
• Annotations, Methods in JUnit
• Junit Test Suites, ANT Build and JUNIT reporting
• Types of Test Automation Framework
• Module Based Testing Framework
• Data Driven Testing Framework
• Keyword Driven Testing Framework
• Hybrid Driven Testing Framework
• How to implement Testing Framework in Project
Object Repository
• Understanding of Object Repository
• Learning sample scripts using object repository
• Page Object Modelling
• Page Factory
JavaScript Functions
• Autosuggestion
• Headless Browser
• Sikuli
• XPath

Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "Selenium IDE- Locating Strategies by Identifier and By Id"

Leave a Message

Your email address will not be published. Required fields are marked *