
- Selenium - Home
- Selenium - Overview
- Selenium - Components
- Selenium - Automation Testing
- Selenium - Environment Setup
- Selenium - Remote Control
- Selenium - IDE Introduction
- Selenium - Features
- Selenium - Limitations
- Selenium - Installation
- Selenium - Creating Tests
- Selenium - Creating Script
- Selenium - Control Flow
- Selenium - Store Variables
- Selenium - Alerts & Popups
- Selenium - Selenese Commands
- Selenium - Actions Commands
- Selenium - Accessors Commands
- Selenium - Assertions Commands
- Selenium - Assert/Verify Methods
- Selenium - Locating Strategies
- Selenium - Script Debugging
- Selenium - Verification Points
- Selenium - Pattern Matching
- Selenium - JSON Data File
- Selenium - Browser Execution
- Selenium - User Extensions
- Selenium - Code Export
- Selenium - Emitting Code
- Selenium - JavaScript Functions
- Selenium - Plugins
- Selenium WebDriver Tutorial
- Selenium - Introduction
- Selenium WebDriver vs RC
- Selenium - Installation
- Selenium - First Test Script
- Selenium - Driver Sessions
- Selenium - Browser Options
- Selenium - Chrome Options
- Selenium - Edge Options
- Selenium - Firefox Options
- Selenium - Safari Options
- Selenium - Double Click
- Selenium - Right Click
- HTML Report in Python
- Handling Edit Boxes
- Selenium - Single Elements
- Selenium - Multiple Elements
- Selenium Web Elements
- Selenium - File Upload
- Selenium - Locator Strategies
- Selenium - Relative Locators
- Selenium - Finders
- Selenium - Find All Links
- Selenium - User Interactions
- Selenium - WebElement Commands
- Selenium - Browser Interactions
- Selenium - Browser Commands
- Selenium - Browser Navigation
- Selenium - Alerts & Popups
- Selenium - Handling Forms
- Selenium - Windows and Tabs
- Selenium - Handling Links
- Selenium - Input Boxes
- Selenium - Radio Button
- Selenium - Checkboxes
- Selenium - Dropdown Box
- Selenium - Handling IFrames
- Selenium - Handling Cookies
- Selenium - Date Time Picker
- Selenium - Dynamic Web Tables
- Selenium - Actions Class
- Selenium - Action Class
- Selenium - Keyboard Events
- Selenium - Key Up/Down
- Selenium - Copy and Paste
- Selenium - Handle Special Keys
- Selenium - Mouse Events
- Selenium - Drag and Drop
- Selenium - Pen Events
- Selenium - Scroll Operations
- Selenium - Waiting Strategies
- Selenium - Explicit/Implicit Wait
- Selenium - Support Features
- Selenium - Multi Select
- Selenium - Wait Support
- Selenium - Select Support
- Selenium - Color Support
- Selenium - ThreadGuard
- Selenium - Errors & Logging
- Selenium - Exception Handling
- Selenium - Miscellaneous
- Selenium - Handling Ajax Calls
- Selenium - JSON Data File
- Selenium - CSV Data File
- Selenium - Excel Data File
- Selenium - Cross Browser Testing
- Selenium - Multi Browser Testing
- Selenium - Multi Windows Testing
- Selenium - JavaScript Executor
- Selenium - Headless Execution
- Selenium - Capture Screenshots
- Selenium - Capture Videos
- Selenium - Page Object Model
- Selenium - Page Factory
- Selenium - Record & Playback
- Selenium - Frameworks
- Selenium - Browsing Context
- Selenium - DevTools
- Selenium Grid Tutorial
- Selenium - Overview
- Selenium - Architecture
- Selenium - Components
- Selenium - Configuration
- Selenium - Create Test Script
- Selenium - Test Execution
- Selenium - Endpoints
- Selenium - Customizing a Node
- Selenium Reporting Tools
- Selenium - Reporting Tools
- Selenium - TestNG
- Selenium - JUnit
- Selenium - Allure
- Selenium & other Technologies
- Selenium - Java Tutorial
- Selenium - Python Tutorial
- Selenium - C# Tutorial
- Selenium - Javascript Tutorial
- Selenium - Kotlin Tutorial
- Selenium - Ruby Tutorial
- Selenium - Maven & Jenkins
- Selenium - Database Testing
- Selenium - LogExpert Logging
- Selenium - Log4j Logging
- Selenium - Robot Framework
- Selenium - AutoIT
- Selenium - Flash Testing
- Selenium - Apache Ant
- Selenium - Github Tutorial
- Selenium - SoapUI
- Selenium - Cucumber
- Selenium - IntelliJ
- Selenium - XPath
- Selenium Miscellaneous Concepts
- Selenium - IE Driver
- Selenium - Automation Frameworks
- Selenium - Keyword Driven Framework
- Selenium - Data Driven Framework
- Selenium - Hybrid Driven Framework
- Selenium - SSL Certificate Error
- Selenium - Alternatives
Selenium IDE - Locating Strategies
Selenium IDE has multiple locating strategies which help to automate test cases. However, Selenium IDE can not identify elements on a web page by default. In order to locate elements, we would need the help of the locators like id, name, css, and xpath.
In addition to the above locators, the older versions of Selenium IDE supported other locators like DOM, and identifier, however, they are deprecated in the latest versions.
Example
Let us take an example of the below page, where we would enter the text Selenium beside the First Name: label. This can be achieved by first locating the elements using various locators.

Identify Web Elements
Right click on the webpage, and click on the Inspect button in the Chrome browser, post this action the HTML code for the web page will be accessible. For inspecting an element on a page, click on the left upward arrow as highlighted below.

Once we had clicked and pointed the arrow to the input box(highlighted in the below image), its HTML code appeared.

Features to Locate Element in Selenium IDE
Once a test would be created after recording in Selenium IDE, we would be able to get the details of any particular step in that test, by clicking on it. Click on the dropdown in the Target field, Selenium IDE while recording successfully captures all the locators like id, name, css, xpath, and so on for an element.
Click on the 4th step, having the values of Command, Target, and Value fields as type, id=name, and Selenium respectively. The other locator values like the name, css, and so on for that element were visible within the Target dropdown.

All the steps that we had performed on the application would be recorded in the Selenium IDE under the Command, Target, and Value fields with a REC button to the top right.
The section highlighted below image denotes the Text Script Editor Pane. It has all the user interactions that had been recorded in the form of test steps when the recording was enabled.

To identify a web element by default in Selenium IDE, click on the Select target in page button as highlighted in the below image.

After clicking the Select target in page button, the user would get the button Select an element on the web page. Once an element is selected, its locator value gets populated by the Selenium IDE.

The corresponding locator value of the selected web element was generated in the Target. Then, if the Find target in page button is clicked, the element whose locator value is populated, gets highlighted on the page.

Please note that, the buttons - Find target in page, and Select target in page, become enabled only if we have a valid value in the Command field else they remain disabled as highlighted in the below image.

Locator ID
The steps to locate the input box using id locator and then enter the text Selenium in Selenium IDE are listed below −
Step 1 − Perform the Steps 1 to 4 of Storing and Accessing Variables.
Step 2 − Enter open in the Command field, and Selenium Automation Practice Form in the Target field, to launch the application.

Step 3 − Enter type in the Command field, id=firstname in the Target field, and Selenium in the Value field. Please note, id=firstname is the id locator and its value as firstname for the input box and Selenium is the value to be entered.

Step 4 − Enter close in the Command field to terminate the browser.

Step 5 − Click on the Run all tests button.

In the example above, we entered the text Selenium in the input box using the id locator beside the First Name: label which appeared under the Log. Besides, we got a green tick at the top, signifying a passed test
Locator Name
The steps to locate the input box using name locator and then enter the text Selenium in Selenium IDE are listed below −
Step 1 − Click on the second step created in the above example and enter type in the Command field, name=firstname in the Target field, and Selenium in the Value field. Please note, name=firstname is the name locator, and its value is firstname of the input box and Selenium is the value to be entered.

Step 2 − Click on Run all tests, and hold back for the test execution to finish.

In the example above, we entered the text Selenium in the input box using the name locator beside the First Name: label which appeared under the Log.
Locator CSS
The steps to locate the input box using css locator and then enter the text Selenium in Selenium IDE are listed below −
Step 1 − Click on the second step created in the above example and enter type in the Command field, css=input#firstname in the Target field, and Selenium in the Value field. Please note, css=input#firstname is the css locator and its value is input#firstname for the input box and Selenium is the value to be entered.

Step 2 − Click on Run all tests.

In the example above, we entered the text Selenium in the input box using the css locator beside the First Name: label which appeared under the Log.
Locator Xpath
The steps to locate the input box using xpath locator and then enter the text Selenium in Selenium IDE are listed below −
Step 1 − Click on the second step created in the above example and enter type in the Command field, xpath=//input[@id='firstname'] in the Target field, and Selenium in the Value field. Please note, xpath=//input[@id='firstname'] is the xpath locator and its value is //input[@id='firstname'] of the input box and Selenium is the value to be entered.

Step 2 − Click on Run all tests at the top.

In the example above, we entered the text Selenium in the input box using the xpath locator beside the First Name: label which appeared under the Log.
Conclusion
This concludes our comprehensive take on the tutorial on Selenium IDE Locating Strategies. Weve started with describing an example and walked through the different locating strategies, and illustrated how to use them along with Selenium. This equips you with in-depth knowledge of the locating Strategies in Selenium IDE. It is wise to keep practicing what youve learned and exploring others relevant to Selenium to deepen your understanding and expand your horizons.