"Positional" XPATH query

Topics: Developer Forum, User Forum
Jan 13, 2009 at 4:43 PM
Hi, I'm trying to use XPATH queries coming out the Firebug Firefox plugin to identify and get content of html elements. You'll get a XPATH using the "inspect" tool in Firebug and selecting "Copy Xpath" from the context menu on the element in the HTML pane.

The XPath resulting is something like:
           /html/body/form/table/tbody/tr/td/div/div/div[2]/table/tbody/tr/td/div/div/div/div/table/tbody/tr/td/a/div

It's something like a simple "position" in the DOM tree, but it doesn't return anything, at least on the pages I tested.

Is there a limitation for thsi kind of queries. Did anyone use something like this with success?

Thank you,

Giorgio
May 27, 2009 at 4:25 AM

I tired the same thing

HtmlAgilitypack seems can't recognize "form" or "tbody", so remove them from your xpath, it might work

May 27, 2009 at 4:32 AM

@webgio: i think Firefox auto gen "tbody" tags.