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
- 1Open Firefox browser with its Mozilla home page
- 2Click on Bug tab at the right corner of the Browser.
- 3Click on Inspect element button and place your tip of cursor on any element for which you want to find XPath
- 4In 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
- 5Right Click on highlighted code and Select Copy XPath like this
- 6Now 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