Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executar chrome com as extensões desabilitadas #374

Closed
estivalet opened this issue Oct 22, 2015 · 7 comments
Closed

executar chrome com as extensões desabilitadas #374

estivalet opened this issue Oct 22, 2015 · 7 comments
Assignees
Milestone

Comments

@estivalet
Copy link
Contributor

Preciso executar um teste com as extensões desabilitadas.

Como faço para executar por exemplo:

capabilities.setCapability("chrome.switches", Arrays.asList("--disable-extensions"));

obrigado.

obs.: Não gostaria de criar um novo perfil no chrome, apenas executá-lo sem as extensões.

@juliancesar juliancesar added this to the 1.5.2 milestone Nov 9, 2015
@juliancesar juliancesar self-assigned this Nov 9, 2015
@juliancesar
Copy link
Contributor

Estivalet, a principio o comportamento padrão é levantar o navegador com as extensões desabilitadas, o que estamos tratando (9de5927) é a possibilidade de profiles no Chrome que hoje não é possível.

@estivalet
Copy link
Contributor Author

pergunto isso pois continuo com o erro: Falha ao carregar a extensão a partir de: c:\users\lestivalet\AppData\Local\Temp\scoped_dir...Loading of unpacked extensions is disabled by the administrator.

O chrome tem uma configuração padrão (instalada pela política empresarial) que eu não tenho acesso para alterar. No caso a única extensão que eu tenho é a Editor do Office 110.1536.1538 para visualizar e editar arquivos do word, excel, powerpoint, etc...

Toda vez que eu rodo o teste automatizado esse alerta é apresentado, e preciso clicar no botão "OK" para que o robô siga adiante.

S.O: Windows 7
Versão do chrome: 45.0.2454.85 m
Versão do chrome driver: 2.20
Versão do dbehave: 1.5.1

E acho que no meu caso o navegador está subindo com essa extensão habilitada

@juliancesar
Copy link
Contributor

@estivalet, na versão 1.5.2-SNAPSHOT foi implementada a questão de profiles com Chrome no commit 9de5927, verifique se esse novo comportamento ajuda.

@estivalet
Copy link
Contributor Author

@juliancesar outra coisa que notei sobre esse erro é que depois que eu clico no botão OK do alerta, o chrome abre normalmente mas demora uns 10 a 15 segundos para ir para a URL da aplicação. E no final do teste sempre dá esse stacktrace:

mesmo erro #349

java.lang.AssertionError: Passo com falha: [br.gov.frameworkdemoiselle.behave.parser.jbehave.BeforeAfterSteps.startStories()] causa: org.jbehave.core.failures.BeforeOrAfterFailed: Method startStories (annotated with @BeforeStories in class br.gov.frameworkdemoiselle.behave.parser.jbehave.BeforeAfterSteps) failed: org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=45.0.2454.85)
(Driver info: chromedriver=2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.09 seconds
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'SETIC-15311', ip: '10.4.3.102', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_45'
Session ID: fb2033d0e3b830753215bdf1e2c82fe2
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\LESTIV~1\AppData\Local\Temp\scoped_dir12192_19485}, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=45.0.2454.85, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]
at org.junit.Assert.fail(Assert.java:91)
at br.gov.frameworkdemoiselle.behave.controller.BehaveContext.run(BehaveContext.java:158)
at br.gov.frameworkdemoiselle.behave.controller.BehaveContext.run(BehaveContext.java:184)
at br.jus.trt4.sac.tests.AquisicoesTest.testRequisicoes(AquisicoesTest.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

@juliancesar
Copy link
Contributor

No commit (a237125) feito ontem e com a SNAPSHOT gerada ontem (1.5.2-SNAPSHOT) a alteração para o seu caso foi feita. Para mim funcionou corretamente.

Foi adicionada a seguinte linha:

chromeOptions.addArguments("--disable-extensions");

Com relação ao último problema relatado, peço que abra outra issue.

@estivalet
Copy link
Contributor Author

@juliancesar Funcionou a alteração, e o erro "cannot get automation extension" não ocorre mais.

Porém notei que depois que o teste finaliza o chrome ficou aberto...
Log após execução das histórias

(AfterStories)
15:01:35,799 INFO (main) [BeforeAfterSteps]: >>Finalizando Aplicação<<

Generating reports view to 'C:\Users\lestivalet\workspace\SACTest\target\jbehave' using formats '[defaultstoryreport, console, html, stats]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
Reports view generated with 6 stories (of which 0 pending) containing 12 scenarios (of which 0 pending)
Failures in reports view: 6 scenarios failed
15:01:36,253 INFO (main) [JBehaveParser]: Finalizando Parser JBehave...
15:01:36,253 INFO (main) [BehaveContext]: --------------------------------
15:01:36,253 INFO (main) [BehaveContext]: Demoiselle Behave Finalizado
15:01:36,253 INFO (main) [BehaveContext]: --------------------------------

@estivalet
Copy link
Contributor Author

@juliancesar Na verdade o chrome não estava fechando pois eu estava usando a versão portátil do Chrome

behave.runner.screen.binaryPath=C:/Users/lestivalet/Downloads/GoogleChromePortable/GoogleChromePortable.exe

Ao usar o chrome padrão instalado no Windows ele fechou normalmente. Vou fechar essa issue, mas acredito que tem algum problema ao configurar o chrome portátil para rodar os testes automatizados

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants