对于“http://stackoverflow.com/”,我有以下 xpath '/html/body/div[4]/div[2]/div/div/h1',即“热门问题”标题。
如何在 HtmlAgilityPack 中使用它?
var wc = new WebClient();
wc.Encoding = Encoding.UTF8;
var html = wc.DownloadString("http://stackoverflow.com/");
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(html);
var node = htmlDoc.DocumentNode.SelectNodes("/html/body/div[4]/div[2]/div/div/h1");
返回空