Using Firebug in Selenium WebDriver to find Xpath and CSS Selector
Finding xpath using Firebug in Selenium WebDriver is so easy, So the 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.
Oh I am taking much time of yours, Ok then let me start with the steps to find out the Xpaths and CSS path through Firebug of any element on a web page. But let me tell you what XPath is
Xpath is just the combination of HTML tag that helps in identifying the specific element on a webpage.
But before this
1- Firefox should be installed
2- Firebug add-on should be installed. To install Firebug follow this, go to Tool–> Add-ons –> Search Firebug –> Install
Assuming you have installed Firebug and Firefox on your Windows or Mac machine.
Steps for finding Xpath through Firebug
1- Open Firefox browser with its Mozilla home page
3- Click on Inspect element button and place your tip of cursor on any element for which you want to find Xpath
4- Here I have selected the Mozilla logo as soon as we put cursor on Logo and click once on it, HTML tag get highlighted in Firebug
6- Now place this Xpath in to your script.
But i will suggest first learn how to find Xpath Without using Firefox and for that read my last blog post XPath in Automation mainly in Selenium
Now this tool needs not to be installed separetly because Firefox has made effort and have integrated this with firefox. So you can start using this as soon as you download and install the firefox browser. But every single steps you can use in firefox to find the xpath and CSS.
To read more about this read this link