XPath tip for Hpricot – no tbody

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.

1 thought on “XPath tip for Hpricot – no tbody

Leave a Reply

Your email address will not be published. Required fields are marked *