I want to extract all comments from the following link using HtmlAgilityPackage using C#.Page that needs to be scrapped is as follows
The code that I have written is as follows:
var getHtmlWeb = new HtmlWeb();
var document = getHtmlWeb.Load(txtinputurl.Text);
var aTags = document.DocumentNode.SelectNodes("./div[@class='com_user_text']");
int counter = 1;
if (aTags != null)
{
foreach (var aTag in aTags)
{
lbloutput.Text += lbloutput.Text + ". " + aTag.InnerHtml + "\t" + "<br />";
counter++;
}
}
The variable aTags is returning null value.
I have also tried using the Xpath: //div[@class='newcomment_list']/ul/li/div[@class='headerwrap']/div[@class='com_user_text']
but still the same result.Please help me with the correct Xpath.
Thanks in advance