Reputation: 25
At the moment, I'm trying to run example from the htmlaglitypack official site, but this code is broken: http://html-agility-pack.net/from-browser
I want to extract content after script completing. My code:
private void button1_Click(object sender, EventArgs e)
{
string url = "http://html-agility-pack/from-browser";
var web2 = new HtmlWeb();
var doc2 = web2.LoadFromBrowser(url, html =>
{
return !html.Contains("<div id=\"uiDynamicText\"></div>");
});
var t2 = doc2.DocumentNode.SelectSingleNode(".//div[@id='uiDynamicText']");
listBox1.Items.Add("Text 2: " + t2.InnerHtml + t2.OuterHtml);
}
t2
stay as null. What is the problem?
Upvotes: 2
Views: 3646
Reputation: 71
the HAP code also has wrong URL (missing ".net") so the code should read string url = "https://html-agility-pack.net/from-browser";
Upvotes: 2