我之前在vb中搜索过如何点击网页上的链接,实际上在这个网站上得到了很好的答案。但现在我试图点击另一个链接,让我发布它的代码,这样更容易理解。(第一次问问题,所以放轻松我哈哈)
<div class="pauseButton" style="display: block;"><a href="#" address="true"></a></div>
这是我的代码(这是潘多拉的顺便说一句,这是我的代码让你登录。)
Public Class fMain
Dim elementCollection As HtmlElementCollection
Private Sub fMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
wb.Navigate("http://www.pandora.com")
End Sub
'buttons
Private Sub bLogin_Click(sender As Object, e As EventArgs) Handles bLogin.Click
elementCollection = wb.Document.GetElementsByTagName("input")
For Each ele As HtmlElement In elementCollection
If ele.GetAttribute("name").Equals("email") Then
ele.SetAttribute("Value", tbEmail.Text)
End If
If ele.GetAttribute("name").Equals("password") Then
ele.SetAttribute("Value", tbPassword.Text)
End If
If ele.GetAttribute("type") = "submit" Then
ele.InvokeMember("click")
End If
Next
End Sub
Private Sub bSignOut_Click(sender As Object, e As EventArgs) Handles bSignOut.Click
End Sub
Private Sub bPlay_Click(sender As Object, e As EventArgs) Handles bPlay.Click
Dim IsRightElement As Boolean = False
For Each ele As HtmlElement In wb.Document.Links
If IsRightElement Then
ele.InvokeMember("click")
IsRightElement = False
Exit For
End If
If ele.GetAttribute("class") = "playButton" Then
IsRightElement = True
End If
Next
End Sub
Private Sub bPause_Click(sender As Object, e As EventArgs) Handles bPause.Click
End Sub
Private Sub bFavorite_Click(sender As Object, e As EventArgs) Handles bFavorite.Click
End Sub
End Class
任何帮助将不胜感激,如果我让问题变得混乱,我很抱歉,但我几乎知道如何单击具有特定 href="link.com" 的链接,但在这里,唯一将播放按钮与任何其他按钮区分开来的是它的 href="#" 所以帮助不大。再次感谢先进。(:
编辑:我正在尝试制作潘多拉流媒体,我应该在前面提到过。