Emily30187
New Member
- Joined
- Jun 13, 2017
- Messages
- 1
Hi,
I've gota macro that opens a webpage and logs me in to a portal. It then navigates to a new tab but am then stuck as I can't find the element name for the next button. I can debug.print the element names on the initial webpage but nothing further than that appears in my immediate window.
Here is my code so far:
Sub Log_In()
On Error GoTo Err_Clear
sURL = "MY WEBPAGE"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLdoc = oBrowser.document
' ***INTIAL PAGE***
HTMLdoc.all.emailAddress.Value = "MY EMAIL ADDRESS"
HTMLdoc.all.Password.Value = "MY PASSWORD"
HTMLdoc.all.Login.Click
'***SECOND PAGE***
HTMLdoc.all.rEPORTS.Click
'***THIRD PAGE***
HTMLdoc.all.I NEED THIS.Click
For Each oHTML_Element In HTMLdoc.getElementsByTagName("submitButtonName")
Debug.Print oHTML_Element.Name
Next
Debug.Print TDelement.ID, TDelement.Value
Debug.Print oHTML_Element.Name
' oBrowser.Refresh ' Refresh If Needed
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Hope you can help
Em
I've gota macro that opens a webpage and logs me in to a portal. It then navigates to a new tab but am then stuck as I can't find the element name for the next button. I can debug.print the element names on the initial webpage but nothing further than that appears in my immediate window.
Here is my code so far:
Sub Log_In()
On Error GoTo Err_Clear
sURL = "MY WEBPAGE"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLdoc = oBrowser.document
' ***INTIAL PAGE***
HTMLdoc.all.emailAddress.Value = "MY EMAIL ADDRESS"
HTMLdoc.all.Password.Value = "MY PASSWORD"
HTMLdoc.all.Login.Click
'***SECOND PAGE***
HTMLdoc.all.rEPORTS.Click
'***THIRD PAGE***
HTMLdoc.all.I NEED THIS.Click
For Each oHTML_Element In HTMLdoc.getElementsByTagName("submitButtonName")
Debug.Print oHTML_Element.Name
Next
Debug.Print TDelement.ID, TDelement.Value
Debug.Print oHTML_Element.Name
' oBrowser.Refresh ' Refresh If Needed
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
Hope you can help
Em