mark 如下代码,细节自己调整
Dim htme,htmaccount As System.Windows.Forms.HtmlElement
Dim web As System.Windows.Forms.WebBrowser = e.Form.Controls("WebBrowser1").BaseControl
Dim enc As String
web.Navigate("http://www.newrank.cn/public/info/search.html")
Do While web.ReadyState <> 4
Application.DoEvents
Loop
htmaccount = web.Document.getelementbyid("txt_account")
If htmaccount IsNot Nothing Then
htmaccount.Innertext = "旅游" '填入搜索关键字
htme = web.Document.getelementbyid("btn_search") '找到搜索按钮
htme.Invokemember("click") '自动点击搜索按钮
Do While web.Document.getelementbyid("result_count").InnerText = ""
Application.DoEvents
Loop
Dim result As Integer = web.Document.getelementbyid("result_count").InnerText
If result = 0 Then
messagebox.show( "没有找到该公众号" )
Else
Do While web.Document.getelementbyid("result_list").children.Count = 0
Application.DoEvents
Loop
Dim ls = web.Document.getelementbyid("result_list").GetElementsByTagName("div")
For Each l As object In ls
If l.GetAttribute("ClassName") = "new_add_shopcar" Then
l.Invokemember("click")
End If
Next
End If
End If