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.Navigate("http://www.mypage.com")
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
Dim btns
Set btns = IE.Document.GetElementsByClassName("btn btn-default pull-right")
For Each btn In btns
    If Button.InnerHTML.Contains("Login") Then
        btn.Click
        Exit For
    End If
Next
Comments