Estou com um problema que não consigo achar a solução.
Preciso que minha macro acesse um site, faça o login e, na página seguinte a do login ela clique em um botão específico.
Consegui criar a macro até o login, mas após não estou conseguindo. Abaixo segue o cód.
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Sub Login()
Dim oHTML_Element As IHTMLElement
Dim sURL As String
On Error GoTo Err_Clear
sURL = "https://esaj.tjce.jus.br/sajcas/login?service=https%3A%2F%2Fesaj.tjce.jus.br%2Fesaj%2Fj_spring_cas_security_check"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.timeout = 60
oBrowser.navigate sURL
oBrowser.Visible = True
Do
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = oBrowser.Document
HTMLDoc.all.usernameForm.Value = "64042936253"
HTMLDoc.all.passwordForm.Value = "23q23q23q"
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
Next
Err_Clear:
Resume Next
End Sub