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; using HtmlAgilityPack; using System.Net; namespace Project_1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; } private void button1_Click(object sender, EventArgs e) { HtmlWeb myweb = new HtmlWeb(); int page=0; HtmlAgilityPack.HtmlDocument doc=null; for (page = 1; page <= 5; page++) { doc = myweb.Load("https://www.practo.com/jamnagar/doctors" + "?page=" + page); var headernames = (doc.DocumentNode.SelectNodes("//h2[@class='doctor-name']")).ToList(); foreach (var item in headernames) { listBox1.Items.Add(item.WriteContentTo()); } } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)