Edit

Edited by Dwarika Dhish Mishra, Teresa, VC, Steve

People who have been dirtying their hand in automation with selenium would be familiar with the pain of failing test due to wrong element locator and because they don’t get the right way to find out the XPaths, CSS path. Firebug is the solution of all such pain and it also helps you to speed your automation work. This article outlines the steps to find out the XPaths and CSS path through Firebug of any element on a web page. XPath is just the combination of HTML tag that helps in identifying specific element on a webpage.

Edit Steps

  1. 1
    Open Firefox browser with its Mozilla home page
  2. 2
    Click on Bug tab at the right corner of the Browser.

  3. 3
    Click on Inspect element button and place your tip of cursor on any element for which you want to find XPath

  4. 4
    In this example, the Mozilla logo was selected. As soon as you hover your cursor on the Logo and click once on it, its HTML tag will get highlighted in Firebug
  5. 5
    Right Click on highlighted code and Select Copy XPath like this

  6. 6
    Now place this XPath in to your script

Edit Things You'll Need

  • Firefox should be pre-installed on system
  • TO install Firebug Plugin go to Tool--> Add-ons-->Search for "Firebug" --> Install--> Restart Firefox

Edit Sources and Citations

Article Info

Categories: Software Testing

Recent edits by: VC, Teresa, Dwarika Dhish Mishra

Share this Article:

Thanks to all authors for creating a page that has been read 5,343 times.

Was this article accurate?

Yes No


x

Thank Our Volunteer Authors.

Give wikiHow a +1.