好吧,我猜标题大部分内容。我已经知道如何点击浏览器中的按钮,但代码不能在这个太平洋按钮上工作。我希望这里的代码是允许的,抱歉,如果它不是......
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button3.Enabled = True
Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
For Each webpageelement As HtmlElement In allelements
'AMF Email
WebBrowser1.Document.GetElementById("Email").InnerText textbox1.text
'AMF Password
WebBrowser1.Document.GetElementById("password").InnerText = textbox2.text
'AMF Login Button
If webpageelement.GetAttribute("value") = "Login" Then
webpageelement.InvokeMember("click")
End If
Next
'Navigates to FB likes to begin the process
WebBrowser1.Navigate("http://addmefast.com/free_points/facebook_likes")
Button2.PerformClick()
End Sub
好的,所有这些代码完美无缺,但现在我希望它能够点击" Like"此链接上的按钮:http://addmefast.com/free_points/facebook_likes
但是,我找不到正确的值。任何人都可以帮助获得#34; Like"的正确价值。该页面上的按钮?
VB2012
当我尝试"检查元素"在按钮上,这就是它所显示的;
<div class="btn3">
Like
</div>
答案 0 :(得分:0)
您可以使用以下代码执行此操作:
For Each elem as HtmlElement in WebBrowser1.Document.All
If elem.GetAttribute("class") = "btn3" Then
elem.InvokeMember("click")
End If
Next
对不起,如果这里有任何错误。我习惯使用IDE代码... 我希望这有帮助,
Rodit