0
 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        WebBrowser1.Document.GetElementById("xn_logout").InvokeMember("click")
    End Sub

无法从网站单击注销链接我在这里做错了什么。

4

1 回答 1

0
    'WebBrowser1.Document.GetElementById("xn_username").InvokeMember("click")

    Dim HtmlElementcoll As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("a")
    For Each elem As HtmlElement In HtmlElementcoll
        ' Check the attributtes you want
        If elem.GetAttribute("dojotype") = "PostLink" Then
            'Check even the text if you want
            ' If elem.InnerText = "Sign In" Then
            'Invoke your event
            elem.InvokeMember("click")
            'End If
        End If
    Next
End Sub

根据我的研究,这就是我得到的..

于 2017-09-04T17:55:33.360 回答