snowboy001
Board Regular
- Joined
- Dec 5, 2009
- Messages
- 100
I have figured out how to put my User Name and Password into the webpage, but I can not figure out how to click on the Logon button. Can anyone help out with this?
The HTML source coding for the button is:
Code:
Sub Login()
Dim appIE As InternetExplorer
Dim sURL As String
Dim UserN As Variant, Pw As Variant
Dim Element As HTMLButtonElement
Dim btnInput As MSHTML.HTMLInputElement
Dim ElementCol As MSHTML.IHTMLElementCollection
Application.ScreenUpdating = False
Set appIE = New InternetExplorer
sURL = "[URL="http://172.23.5.53:8081/wells/Login.jsp"]my url[/URL]"
With appIE
.navigate sURL
.Visible = True
End With
Do While appIE.Busy
Loop
Set UserN = appIE.document.getElementsByName("User")
If Not UserN Is Nothing Then
UserN(0).Value = "my username"
End If
Set Pw = appIE.document.getElementsByName("password")
If Not Pw Is Nothing Then
Pw(0).Value = "my password"
End If
Set ElementCol = appIE.document.getElementsByTagName[COLOR=black]("[COLOR=#ff0000]I need this value[/COLOR]")[/COLOR]
For Each btnInput In ElementCol
If btnInput.Value = "[COLOR=#ff0000]I need this value[/COLOR]" Then
btnInput.Click
Exit For
End If
Next btnInput
Do While appIE.Busy
Loop
Application.ScreenUpdating = True
Set appIE = Nothing
End Sub
The HTML source coding for the button is:
Code:
[COLOR=#0000ff]<[/COLOR][COLOR=#800000]tr[/COLOR][COLOR=#0000ff]>[/COLOR][COLOR=#0000ff]<[/COLOR][COLOR=#800000]td[/COLOR][COLOR=#0000ff]>[/COLOR][COLOR=#0000ff]<[/COLOR][COLOR=#800000]input[/COLOR][COLOR=#0000ff] [/COLOR][COLOR=#ff0000]type[/COLOR][COLOR=#0000ff]="hidden" [/COLOR][COLOR=#ff0000]value[/COLOR][COLOR=#0000ff]="login" [/COLOR][COLOR=#ff0000]name[/COLOR][COLOR=#0000ff]="jboEvent">[/COLOR][COLOR=#0000ff]</[/COLOR][COLOR=#800000]td[/COLOR][COLOR=#0000ff]>[/COLOR][COLOR=#0000ff]<[/COLOR][COLOR=#800000]td[/COLOR][COLOR=#0000ff]>[/COLOR][COLOR=#0000ff]<[/COLOR][COLOR=#800000]a[/COLOR][COLOR=#0000ff] [/COLOR][COLOR=#ff0000]href[/COLOR][COLOR=#0000ff]="#" [/COLOR][COLOR=#ff0000]*******[/COLOR][COLOR=#0000ff]="submitForm('form1',1,{'jboEvent':'login'});return false">[/COLOR][COLOR=#0000ff]<[/COLOR][COLOR=#800000]img[/COLOR][COLOR=#0000ff] [/COLOR][COLOR=#ff0000]src[/COLOR][COLOR=#0000ff]="/abc/cabo/images/cache/en/b-login.gif" [/COLOR][COLOR=#ff0000]alt[/COLOR][COLOR=#0000ff]="Logon" [/COLOR][COLOR=#ff0000]border[/COLOR][COLOR=#0000ff]="0" [/COLOR][COLOR=#ff0000]align[/COLOR][COLOR=#0000ff]="absmiddle" [/COLOR][COLOR=#ff0000]width[/COLOR][COLOR=#0000ff]="52" [/COLOR][COLOR=#ff0000]height[/COLOR][COLOR=#0000ff]="21">[/COLOR][COLOR=#0000ff]</[/COLOR][COLOR=#800000]a[/COLOR][COLOR=#0000ff]>[/COLOR][COLOR=#0000ff]</[/COLOR][COLOR=#800000]td[/COLOR][COLOR=#0000ff]>[/COLOR][COLOR=#0000ff]</[/COLOR][COLOR=#800000]tr[/COLOR][COLOR=#0000ff]>[/COLOR]