比如,这个网址 http://hb.122.gov.cn/views/examappointpub.html
就可以这样写代码获取
Dim web = Forms("窗口1").controls("webbrowser1").basecontrol
Dim count = web.Document.GetElementById("planContent").GetElementsByTagName("span")(0).InnerText
msgbox(count)
For k As Integer = 1 To Math.Ceiling(count / 10)
Dim tb = web.Document.GetElementById("tableContent")
Dim trs = tb.GetElementsByTagName("tr") '根据标签得到数据集合
For i As Integer = 1 To trs.count-1
output.show(trs(i).InnerText)
Dim tds = trs(i).GetElementsByTagName("td")
For j As Integer = 0 To tds.count-1
output.show(tds(j).InnerText)
Next
Next
Do Until web.Document.GetElementById("mypagination1") IsNot Nothing
Application.DoEvents
Loop
Dim pgs = web.Document.GetElementById("mypagination1")
For Each pg As object In pgs.GetElementsByTagName("a")
If pg.InnerText = "下一页" Then
pg.InvokeMember("click")
Exit For
End If
Next
Next