Featured Post

Apache redirect subdomains to non www, and regular domains to www

For SEO purposes, it’s always a good idea to send all visitors to one domain for your site. For example, Google will index both http://example.com and http://www.example.com and count it as duplicate content. Therefore, it’s a good idea to forward all traffic to one or the other. In the...

Read More

Working with xpath with Firebug

Posted by James | Posted in Public | Posted on 06-12-2010

Tags: , ,

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/