Working with xpath with Firebug
Posted by James | Posted in Public | Posted on 06-12-2010
Tags: firebug, selenium, xpath
0
from: http://blog.browsermob.com/2009/04/test-your-selenium-xpath-easily-with-firebug/
The author goes on to suggest Firebug as a great tool for doing this kind of work, which we tend to agree with and have covered previously. But they missed one of the most important functions: the ability to easily test XPath expressions from within Firebug!
Very few Firebug users know about this, so take note: Firebug adds a $x function that can be called from the console. It takes an XPath in the form of a String and will spit out the HTML elements that it evaluates to directly back in the console. You can then mouse over the elements and check that the XPath is working correctly:
$x(“//input[@class='cart-domain-pr-option'][1]“);
Also worth a read:
http://www.chinhdo.com/20080829/web-scraping-htmlxml-parsing-and-firebugs-copy-xpath-feature/


