SEMrush

Xpath – How to locate WebElements using Xpath ?




New Arrival of Clothing for all, Big brands at affordable prices. Don't forget to check the daily deals!


ShowOff your Trendy self. Discover the fashionista in You. Clothing For  the more confident YOU 👍



  When we want to use Xpath to locate a web element based , we need to follow certain pre defined rules.
First of all, let us understand what is Xpath ?
Xpath can be expanded as XML Path . XML stands for Extensible Markup Language .
XML is a language which is is used to store, organize and transport arbitrary data.
It stores data in a key-value pair similar to HTML tags. Therefore xpath can be used to locate HTML elements.


Here we will see, how we can identify and locate text "Google" on the web page .

How to create Xpath ?
You can download an add-ons called “Firebug” and “Firepath”  for Mozilla Firefox browser 










Steps to perform in order to locate the web element using Xpath :

1. Load the url in the browser.
2. Click on the “Firepath” tab
3. Click on the “Arrow” icon on the extreme left
4. Now click on the element on the webpage, whose Xpath you want to check
5. It will show the Xpath of the webelemt in the textbox below “firepath” tab





Sometimes this automatically generated Xpath is not able to identify the web element correctly.
Then we need to make changes to this xpath to fit out need.

In the next post we will see , how we can tweek this automatically generated Xpath , to fullfill our requirement.

Comments