I want to create an automatic login program for this website using VB.net and Internet Explorer as browser. I am able to write the username and the password in the right boxes but I am not able to click the "Login" button. Here is my code:
Public Class Form1
Dim appIE As Object ' InternetExplorer.Application
Dim UserN As Object ' MSHTML.IHTMLElement
Dim PW As Object ' MSHTML.IHTMLElement
Dim Element As Object ' HTMLButtonElement
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
appIE = CreateObject("InternetExplorer.Application")
With appIE
.Navigate("www.bwin.it")
.Visible = True
End With
Do While appIE.Busy
Loop
UserN = appIE.Document.getElementsByName("ctl03$ctl12$loginview$baw_template$logincontrol$edtUsername")
If Not UserN Is Nothing Then
UserN(0).Value = "11111"
End If
PW = appIE.Document.getElementsByName("ctl03$ctl12$loginview$baw_template$logincontrol$edtPasswordDummy")
If Not PW Is Nothing Then
PW(0).Value = "aaaaaaaa"
End If
End Sub
End Class
I tried different ways but I didn't get it yet. What am I missing?