1
Hello!
My problem is this... I am doing the access to a site, where I provide login and password and travel through the pages to my page of interest.
I have a feature that always lists all links on the active page in IE.
The problem is that when I get to my page of interest, that’s where there’s a link to download file. rar, the function to list links does not show me exactly this link of interest.
I’m new to this kind of programming, so what I’ve built so far are blocks that I’ve researched on forums, maybe the solution is simple, but it’s not going.
Below is the code... I can not provide information of the final page because it is private, but what matters is to click on the download.
Sub Lista_links(IE)
Set internetdata = IE.Document
Set internetlink = internetdata.getElementsByTagName("a")
I = 1
For Each internetinnerlink In internetlink
ActiveSheet.Cells(I, 4) = internetinnerlink.href
I = I + 1
Next internetinnerlink
End Sub
Sub FazerLoginSite()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.Navigate ("site primario")
While .Busy Or .ReadyState <> 4: DoEvents: Wend
On Error GoTo Ja_logado
.Document.getElementById("auth_logout").Click
While .Busy Or .ReadyState <> 4: DoEvents: Wend
.Navigate ("site que me redireciona para o site de interesse")
While .Busy Or .ReadyState <> 4: DoEvents: Wend
Ja_logado:
.Navigate ("site de interesse")
.Document.getElementById("id-username").Focus
.Document.getElementById("id-username").Value = "meu login"
.Document.getElementById("id-password").Focus
.Document.getElementById("id-password").Value = "minha senha"
.Document.forms(0).submit
While .Busy Or .ReadyState <> 4: DoEvents: Wend
.Navigate ("acessa um link específico na página")
While .Busy Or .ReadyState <> 4: DoEvents: Wend
'
'Debug.Print .LocationURL
Sheets("Plan1").Activate
Call Lista_links(IE)
.Navigate2 ("NESSA PARTE, EU ACESSO A PÁGINA QUE TEM O LINK PARA DOWNLOAD"), CLng(2048)
While .Busy Or .ReadyState <> 4: DoEvents: Wend
'NESSA PARTE DO CÓDIGO, QUANDO EU LISTO OS LINKS NOVAMENTE, O ÚNICO LINK QUE NÃO APARECE É O DE DOWNLOAD .RAR!
Sheets("Plan2").Activate
Call Lista_links(IE)
End With
'IE.Quit
Set IE = Nothing
End Sub
The variable I declared as 1 should be 0, right? An array starts at 0 so I guess that could be it.
– StillBuggin