Xpath in htmlagilitypack

Aug 17, 2011 at 7:00 AM

I use "copy XPath" on firebug to get xpath from website. I have used TidyManaged to check and fix as :

 

using (Document document = Document.FromString(Response))           
{               

	document.ShowWarnings = true;  
        document.CleanAndRepair();                                
        Response = document.Save();           
 }            

HtmlNode.ElementsFlags["html"] = HtmlElementFlag.Empty |HtmlElementFlag.Closed|HtmlElementFlag.CanOverlap;            

HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();            

doc.LoadHtml(Response);

HtmlNode node = doc.DocumentNode.SelectSingleNode("/html/body/div[@id='wrapper']/form/table[@class='rSet']//tr[2]/td/div[@class='pCenter']");

I have remove "tbody" tags from xpath string. But node still return null. Any ideas to my problems ? I need to copy firebug's xpath. Thank in advance for helping. :(