Click here to Skip to main content
15,915,828 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys,

I would like to get text from
<span class="fsl fwb">Any name</span> 
in webBrowser Control..I want to get All any names in the webpage file..

Can you help with me ?

THanks in advance for your help..
Posted
Updated 19-Jan-14 8:42am
v2

1 solution

You can use HAP[^]. It is for that kind of jobs.

C#
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);
            }
        }
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900