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

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

didnt work - please help

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 ...

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.