Vb.net Question

How to click "Login" button by navigating to webpage from Internet Explorer object?

I'm navigating to a webpage using:

Dim IE As Object = CreateObject("InternetExplorer.Application")
IE.Document.GetElementById("login").SetAttribute("Value", "myusername")
IE.Document.GetElementById("password").SetAttribute("Value", "mypassword")

'I can't get the submit button to work here.

'the button is coded in html like this:
<button class="btn btn-default pull-right" onclick="return checkCookies();" type="submit" value="Login">Login</button>

I'm not able to click that button. Any help would be appreciated. Thanks

Answer Source
Dim btns
Set btns = IE.Document.GetElementsByClassName("btn btn-default pull-right")
For Each btn In btns
    If Button.InnerHTML.Contains("Login") Then
        Exit For
    End If
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download