Passing XPath to SelectNodes failing

Topics: Developer Forum, User Forum
Apr 5, 2011 at 8:07 PM


I found a node with a given innerText. I retrieved the XPath of this node by calling node.XPath.

It is:


When passing this Xpath value to SelectNodes (code below) I get an empty collection.

What am I missing ? 

string xpath = @"/html[1]/body[1]/form[1]/div[2]/div[3]/div[2]/div[1]/div[1]/div[1]";  

foreach (HtmlNode node in _html.DocumentNode.SelectNodes(xpath))

{   Console.WriteLine(node.InnerText);





Thank you !