You can use
HAP[
^]. It is for that kind of jobs.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Test_WebBrowser
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
this.textBox_URL.Text = @"http://google.com";
}
void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlAgilityPack.HtmlDocument d = new HtmlAgilityPack.HtmlDocument();
d.LoadHtml(this.webBrowser1.DocumentText);
foreach (var item in d.DocumentNode.DescendantsAndSelf())
{
this.textBox_Parse.Text += item.Name + " " + item.NodeType + Environment.NewLine;
}
}
private void button_Go_Click(object sender, EventArgs e)
{
if (this.textBox_URL.Text.Length > 0)
{
this.webBrowser1.Navigate(this.textBox_URL.Text);
}
}
}
}