Erro no código de pesquisa

Marcos853

23-09-2019 11:35:44

Bom dia!

Alguém poderia me ajuda? não estou conseguindo puxar os dados da Web de uma pesquisa já finalizada, fiz o código de pesquisa automatizada, mas não consigo puxar os dados, eu quero apenas o valor!

Obs: O código enter " Application.SendKeys "~", True" está com erro, seria outro ponto que preciso de ajuda!


-----------

Sub Cotação()

Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend


IE.Document.getElementById("select_data").Value = ("22/09/2019")
IE.Document.getElementById("input_cotacao").Value = ("GIG")
IE.Document.getElementById("input_destino").Value = ("PMW")
IE.Document.getElementById("input_cotacao_2").Value = ("1")
IE.Document.getElementById("input_destino_1").Value = ("77730")
IE.Document.getElementById("select_produto").Value = ("GDS")
IE.Document.getElementById("input_entrega").Click
IE.Document.getElementById("quote").Click

While .Busy Or .ReadyState <> 4:
DoEvents:
Wend

On Error GoTo Invalido

IE.Document.getElementById("input_name").Value = ("Marcos")
IE.Document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.Document.getElementById("input_email").Value = ("marcos.abreu@gmail.com.br")
IE.Document.getElementById("input_company").Value = ("Marcos Patricio")
Application.SendKeys "~", True




Invalido:



End With


End Sub

Julio Mangilli

23-09-2019 12:06:11

Olá amigo,

Para o segundo botão funcionar.

Application.SendKeys "~", True
Mude para
IE.Document.getElementById("Cadastrar").Value = Button.Click

Estou na correria mas vou tentar em outro momento dar uma olhada para puxar as informações.

Abraço

Marcos853

23-09-2019 14:34:42

Muito Obrigado!!!

Se conseguir me ajudar a puxar os dados (em especifico o valor da cotação), eu ficarei bastante agradecido!

Marcos853

23-09-2019 17:18:46

Julio Mangilli escreveu: ↑Seg Set 23, 2019 9:06 am Olá amigo,

Para o segundo botão funcionar.

Application.SendKeys "~", True
Mude para
IE.Document.getElementById("Cadastrar").Value = Button.Click

Estou na correria mas vou tentar em outro momento dar uma olhada para puxar as informações.

Abraço
Amigo, esse código --- IE.Document.getElementById("Cadastrar").Value = Button.Click ---- não está funcionando, ele nao da erro, mas nao acontece nada tb!

Julio Mangilli

23-09-2019 18:10:51

Opa, serio? Bom tentamos assim agora então amigo.



Sub Cotação()

Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
DoEvents:
Wend


IE.document.getElementById("select_data").Value = ("22/09/2019")
IE.document.getElementById("input_cotacao").Value = ("GIG")
IE.document.getElementById("input_destino").Value = ("PMW")
IE.document.getElementById("input_cotacao_2").Value = ("1")
IE.document.getElementById("input_destino_1").Value = ("77730")
IE.document.getElementById("select_produto").Value = ("GDS")
IE.document.getElementById("input_entrega").Click
IE.document.getElementById("quote").Click

While .Busy Or .ReadyState <> 4:
DoEvents:
Wend

On Error GoTo Invalido

IE.document.getElementById("input_name").Value = ("Marcos")
IE.document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.document.getElementById("input_email").Value = ("marcos.abreu@spharmu.com.br")
IE.document.getElementById("input_company").Value = ("SPecial Pharmus")
Dim objElementCol As Object
Dim objElement As Object

Set objElementCol = IE.document.getElementsByTagName("input")

For Each objElement In objElementCol
If objElement.Value = "Cadastrar" Then
objElement.Click
Exit For
End If
Next objElement







Invalido:



End With


End Sub

Julio Mangilli

24-09-2019 16:22:28

Sobre a questão do botão click
segue, aqui funcionou

Sub Cotação()

Dim IE As Object
Set IE = CreateObject("InternetExplorer.application")
With IE
.Visible = True
.NAVIGATE ("https://servicos.gollog.com.br/Home/Inicio#cotacao")
While .Busy Or .ReadyState <> 4:
Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 1)
DoEvents:
Wend


IE.Document.getElementById("select_data").Value = ("22/09/2019")
IE.Document.getElementById("input_cotacao").Value = ("GIG")
IE.Document.getElementById("input_destino").Value = ("PMW")
IE.Document.getElementById("input_cotacao_2").Value = ("1")
IE.Document.getElementById("input_destino_1").Value = ("77730")
IE.Document.getElementById("select_produto").Value = ("GDS")
IE.Document.getElementById("input_entrega").Click
IE.Document.getElementById("quote").Click

While .Busy Or .ReadyState <> 4:
Application.Wait TimeSerial(Hour(Now), Minute(Now), Second(Now) + 1)
DoEvents:
Wend

On Error GoTo Invalido

IE.Document.getElementById("input_name").Value = ("Marcos")
IE.Document.getElementById("input_phone").Value = ("(99) 9999-99999")
IE.Document.getElementById("input_email").Value = ("marcos.abreu@spharmu.com.br")
IE.Document.getElementById("input_company").Value = ("SPecial Pharmus")
Dim objElementCol As Object
Dim objElement As Object

Set objElementCol = IE.Document.getElementsByTagName("input")

For Each objElement In objElementCol
If objElement.Value = "Cadastrar" Then
objElement.Click
Exit For
End If
Next objElement







Invalido:
End With







End Sub

Marcos853

24-09-2019 18:19:32

Boa tarde!

Deu certo, desculpe a confusão e muito obrigado!

Julio Mangilli

24-09-2019 18:43:58

Magina, estamos aqui para se ajudar, mas coloca o modelinho da planilha que possamos tentar puxar os dados também, já já passa um jedi e resolve ou tentamos também.