Testing XPath in Google Chrome and Firefox
If you ever use tools such as Nokogiri or Selenium trying to come up with the right XPath can be tricky. Wouldn't it be great if we could try out an XPath right in the browser? With Google Chrome and Firefox you can!
In Google Chrome this is built right in - no need to install any extensions for
in Mac OS X) in Google Chrome. Firefox users will need Firebug to get similar
Now we can use
$x to try out our lovely XPath:
> $x("//div[@class='date']") [<div class="date">...</div>] > $x("//a[contains(@href, 'news')]") [<a href="/news">News</a>]