Firebug has been my favorite Firefox add-on for a long time now. In the time before every browser had decent developer tools, Firebug was a revolutionary add-on that allowed many testers, like myself, tools to interact, learn and explore what web applications were doing. I recently upgraded my Firebug to version 2.0. I was pleasantly surprised to find a cool feature that I think testers will find useful – the ability to check XPATHs within Firebug. Thank you Firebug community!
In case you missed it, here is how you use this super-cool feature.
Setup for Firebug 2.0
1. Install/Upgrade-to the latest firefox browser from here. We used version 30.0 of Firefox for this post. Firefox 29.1 did not list Firebug 2.0 as an available add on.
2. Download and install the latest firebug add-on from here.
The firebug icon will appear on the right corner on the tool bar.
Steps to craft your XPath using Firebug 2.0
Lets pretend we want to craft an XPath for the first headline link on my favorite chess website Chessbase.
1.Visit the url http://www.chessbase.com, right click on the top headline and choose to inspect element with Firegbug. You should see something like the screenshot below.
2. We cannot use the text of the link or the href itself since they change on a news site. Instead we look around for something more permanent. We notice that the link (the ‘a-tag’) is nested in a div whose class contains ‘featured_true’. So the XPath we want is
We can test the validity of our XPath in Firebug like in screenshot below
PS: Anton Smirnov (born 2001!) becomes the first chess prodigy to make a guest appearance on our blog. See the second article on the Chessbase screenshot