0

Good Afternoon,

I am having problems clicking a button within a website, heres the html code from the website using firebug on firefox

<input type="submit" onclick="return fnbValidateLogin()" value="Login" name="Login">

Heres the code that i tried

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim MyElementsWeb As HtmlElementCollection = WebBrowser1.Document.All
        For Each LogBtn As HtmlElement In MyElementsWeb
            If LogBtn.GetAttribute("name") = "Login" Then
                LogBtn.InvokeMember("click")
            End If
        Next
    End Sub
End Class
2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by jd2369
0

just change click to submit

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim MyElementsWeb As HtmlElementCollection = WebBrowser1.Document.All
        For Each LogBtn As HtmlElement In MyElementsWeb
            If LogBtn.GetAttribute("name") = "Login" Then
                LogBtn.InvokeMember("submit")
            End If
        Next
    End Sub
End Class
0

I just run this code successfully....

For Each LogBtn As HtmlElement In WebBrowser1.Document.All
            Dim k As String = LogBtn.GetAttribute("Name")

            If k = "CmdSubmit" Then
                LogBtn.InvokeMember("click")
            End If
        Next

This works fine here..

Will you please tell me which website you r trying to login??? Just for researching ...

0

didnt work - this is a web interface to a copier - it has a local ip so you would not be able to take a look unless you want to open a remote session with me?

Edited by jd2369: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.