Vídeo recomendado
https://youtu.be/diWPPPhW-9E

Erro de Abertura do ChromeDriver do Selenium Wrapper VBA [RESOLVIDO]

Perguntas e Repostas sobre os artigos, posts e arquivos que são postados no site
sistem.atc
Acabou de chegar
Acabou de chegar
Mensagens: 8
Registrado em: Sex Out 26, 2018 8:46 am

Erro de Abertura do ChromeDriver do Selenium Wrapper VBA [RESOLVIDO]

Mensagem por sistem.atc »

Bom dia a todos,
Primeiramente gostaria de agradecer a todos pelo excelente site, aprendi muito sobre VBA aqui e agora pretendo a tentar ajudar a todos também :D. Bom vamos a duvida:
Criei um código para acessar um site na Internet e baixar notas automaticamente pelo Selenium Wrapper, tudo funcionando numa boa até que o mesmo começou a dar erro ao abrir o Google Chrome, testei outros navegadores também, porem nenhum deles teve sucesso. Estou com todas as versões atualizadas para as mais recentes do Chromedriver e do Google Chrome. Já tentei incluisive acionar o navegador somente pelo Selenium Basic e assim mesmo não funciona. Abaixo listo as versões de cada arquivo utilizado e o erro. Agradeço a ajuda de todos.
Selenium Wrapper - V 1.0.17.0 / Selenium Basic 2.0.9.0 / chromedriver 2.43 / Excel 2010.

Imagem

Sub baixar_notas()
Dim Driver As New SeleniumWrapper.WebDriver
Dim filial As New Collection
Dim sh As Worksheet
Application.DisplayAlerts = False

Set sh = Sheets("Filiais Completo")
ul = sh.Range("A" & Rows.Count).End(xlUp).Row
at = 2
dd = Date - 1

Email = "meuemail@meuemail.com.br"

On Error Resume Next
Do While at < ul
filial.Add sh.Cells(at, 1), sh.Cells(at, 1)
at = at + 1
Loop
On Error GoTo 0

Driver.Start "Chrome", "http://172.16.1.93/nfsecoldweb/#/page/login"
Driver.Open "http://172.16.1.93/nfsecoldweb/#/page/login"


For a = 1 To filial.Count
On Error Resume Next
If Cells(filial(a).Row, 3) = "OK" Then
login = filial(a)
senha = filial(a)
Application.Wait (Now + TimeValue("0:00:02"))

Driver.assertTitle "NFS-e Cold Web - Login"
Driver.Type "id=user", login
Driver.Type "id=password", senha
Driver.Click "id=btnEnter"
Application.Wait (Now + TimeValue("0:00:10"))
Driver.Click "css=i.fa.fa-filter"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Type "//*[@id=""gridDocuments""]/div[1]/form/div[2]/div/div[2]/div/div/div[2]/div/div/div/input", dd
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Type "//*[@id=""gridDocuments""]/div[1]/form/div[2]/div/div[2]/div/div/div[3]/div/div/div/input", dd
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "xpath=(//button[@type='button'])[96]"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//li[2]/a/span"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//div[2]/div[2]/div"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//div[@id='step1']/div/button"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Type "css=div.form-group > input[type=""text""", filial(a)
Application.Wait (Now + TimeValue("0:00:02"))
Driver.FindElementByXPath("/html/body", 5).Click
Application.Wait (Now + TimeValue("0:00:02"))
Driver.FindElementByXPath("/html/body/div/section/div/div[3]/div/form/div/ol/li[2]/h4", 5).Click
Driver.Type "css=div.bootstrap-tagsinput.parsley-error > input[type=""text""]", Email
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Type "//div[@id='step2']/fieldset/div[3]/div/div/input", filial(a)
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Type "//div[@id='step2']/fieldset/div[4]/div/div/div/textarea", filial(a)
Application.Wait (Now + TimeValue("0:00:02"))
Driver.FindElementByXPath("//*[@id=""tagcc""]/div[1]", 5).Click
Driver.FindElementByXPath("//*[@id=""tag""]/div[1]", 5).Click
Driver.FindElementByXPath("//*[@id=""tagcc""]/div[1]", 5).Click
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//div[@id='step2']/div/button[2]"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "id=selectAll"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//div[@id='step3']/div/button[2]"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//div[@id='divpanelpdf']/div/div[2]/div[2]/label/span"
Driver.Click "//div[@id='step4']/div/button[2]"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//div[@id='step5']/div/button[2]"
Application.Wait (Now + TimeValue("0:00:02"))
Driver.FindElementByXPath("/html/body", 5).Click
Application.Wait (Now + TimeValue("0:00:02"))
Driver.FindElementByXPath("/html/body/div/header/nav/div[2]/ul[2]/li[4]/a/b", 5).Click
Application.Wait (Now + TimeValue("0:00:02"))
Driver.Click "//a[2]/div/div[2]/p"
Application.Wait (Now + TimeValue("0:00:02"))
End If
On Error GoTo 0
Next

Driver.Stop
Application.DisplayAlerts = True
End Sub
Anexos
Sem título.png
Sem título.png (24.88 KiB) Exibido 23843 vezes
Editado pela última vez por sistem.atc em Qua Nov 07, 2018 4:48 pm, em um total de 2 vezes.


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


sistem.atc
Acabou de chegar
Acabou de chegar
Mensagens: 8
Registrado em: Sex Out 26, 2018 8:46 am

Re: Erro de Abertura do ChromeDriver do Selenium Wrapper VBA

Mensagem por sistem.atc »

Pessoal, somente como informação complementar, o Windows que gera o erro é 64 bits, instalei no PC em casa que é 32 bits e está rodando normalmente, não sei se tem a ver.


sistem.atc
Acabou de chegar
Acabou de chegar
Mensagens: 8
Registrado em: Sex Out 26, 2018 8:46 am

Re: Erro de Abertura do ChromeDriver do Selenium Wrapper VBA

Mensagem por sistem.atc »

Boa tarde pessoal. Consegui resolver o problema e estou aqui postando a solução para possíveis consultas futuras de outras pessoas. O problema estava no nível de acesso ao Windows que eu tinha. Quando criei a macro nosso ti tinha disponível um nível de acesso e quando isso foi mudado deu problema. Resumindo, o ChromeDriver tentava criar arquivos para chamar o Google Chrome em uma pasta temporaria e dava acesso negado. Contornei o problema da seguinte forma. Desistalei tudo e reisntalei o Selenium em uma pasta que criei no meus documentos. Pronto tudo voltou a funcionar como um relógio rsrs.
Agradeço a todos que possam tem tentado auxiliar.


Avatar do usuário
webmaster
Administrador
Mensagens: 3114
Registrado em: Sex Jul 24, 2009 2:44 pm
Contato:

Re: Erro de Abertura do ChromeDriver do Selenium Wrapper VBA

Mensagem por webmaster »

Excelente dica!


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


geovani.amgold
Acabou de chegar
Acabou de chegar
Mensagens: 1
Registrado em: Qui Nov 08, 2018 6:37 am

Re: Erro de Abertura do ChromeDriver do Selenium Wrapper VBA

Mensagem por geovani.amgold »

sistem.atc escreveu: Seg Out 29, 2018 2:47 pm Boa tarde pessoal. Consegui resolver o problema e estou aqui postando a solução para possíveis consultas futuras de outras pessoas. O problema estava no nível de acesso ao Windows que eu tinha. Quando criei a macro nosso ti tinha disponível um nível de acesso e quando isso foi mudado deu problema. Resumindo, o ChromeDriver tentava criar arquivos para chamar o Google Chrome em uma pasta temporaria e dava acesso negado. Contornei o problema da seguinte forma. Desistalei tudo e reisntalei o Selenium em uma pasta que criei no meus documentos. Pronto tudo voltou a funcionar como um relógio rsrs.
Agradeço a todos que possam tem tentado auxiliar.
Meu caro, muito o brigado por postar a solução aqui neste fórum fantástico.
Poderia informar como vc fez para isntalar o selenium na pasta em seu s documentos, pois eu já tentei e não consigo pois ele não me abre a opção de selecionar local.

desde já agradeço pela sua atenção.


sistem.atc
Acabou de chegar
Acabou de chegar
Mensagens: 8
Registrado em: Sex Out 26, 2018 8:46 am

Re: Erro de Abertura do ChromeDriver do Selenium Wrapper VBA

Mensagem por sistem.atc »

geovani.amgold escreveu: Qui Nov 08, 2018 5:07 pm
sistem.atc escreveu: Seg Out 29, 2018 2:47 pm Boa tarde pessoal. Consegui resolver o problema e estou aqui postando a solução para possíveis consultas futuras de outras pessoas. O problema estava no nível de acesso ao Windows que eu tinha. Quando criei a macro nosso ti tinha disponível um nível de acesso e quando isso foi mudado deu problema. Resumindo, o ChromeDriver tentava criar arquivos para chamar o Google Chrome em uma pasta temporaria e dava acesso negado. Contornei o problema da seguinte forma. Desistalei tudo e reisntalei o Selenium em uma pasta que criei no meus documentos. Pronto tudo voltou a funcionar como um relógio rsrs.
Agradeço a todos que possam tem tentado auxiliar.
Meu caro, muito o brigado por postar a solução aqui neste fórum fantástico.
Poderia informar como vc fez para isntalar o selenium na pasta em seu s documentos, pois eu já tentei e não consigo pois ele não me abre a opção de selecionar local.

desde já agradeço pela sua atenção.
Boa tarde Giovanni,
O Selenium Basic não abriu está opção mesmo, somente o Selenium wrapper. Vou ver se tem como alterar direto na chave e depois posto o resultado ok.


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


Responder