简体   繁体   中英

Vb.net logout link invokemember

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

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

Not able to click logout link from a website what am i doing wrong here.

    '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

According to my research that is what i got..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM