Candy Addict linked from BusinessWeek! Scored THREE $1 T-shirts from NerdyShirts
Mar 31

When using a plugin in Firefox to get the XPath of an item, be aware that Firefox inserts tbody tags into the source. So, if you get an XPath like

/html/body/div[@id='content']/table/tbody/tr/td[1]/div/table/tbody/tr/td[1]/table/tbody/tr[2]/td[3]

Do a View Source in Firefox and see if the tbody tags are actually in the source or not. If not, remove the tbody tags in the XPath then the modified XPath will work with Hpricot.

Tags: , ,

One Response to “XPath tip for Hpricot - no tbody”

  1. Aaron Says:

    Thanks for the useful tip… I wish I had seen this before spending hours trying to debug.

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image