demoiselle / behave

Demoiselle Behave
https://www.frameworkdemoiselle.gov.br/dbehave/
29 stars 53 forks source link

Erro ao rodar exemplo do archetype jbehave-selenium com navegador Google Chrome #182

Closed rogernobre closed 10 years ago

rogernobre commented 10 years ago

Erro ao rodar exemplo do archetype jbehave-selenium com navegador Google Chrome 32.0.1700.107 (chromedriver -> http://chromedriver.storage.googleapis.com/index.html), no Windows 7 64 bits, Demoiselle Behave 1.3.1 e 1.3.2-SNAPSHOT

A página inicial é aberta mas não preenche nada:

18:17:54,424 INFO (main) [BehaveContext]: -------------------------------- 18:17:54,425 INFO (main) [BehaveContext]: Demoiselle Behave Iniciado 18:17:54,425 INFO (main) [BehaveContext]: -------------------------------- 18:17:54,529 INFO (main) [JBehaveParser]: Configurando Parser JBehave... 18:17:54,550 INFO (main) [JBehaveParser]: Iniciando Parser JBehave... 18:17:54,550 INFO (main) [JBehaveParser]: Executando história: [[stories\search.storyConverted]] Processing system properties {} Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=true,verboseFailures=true,verboseFiltering=false,storyTimeoutInSecs=3600,threads=1]

(BeforeStories) 18:17:54,805 INFO (main) [BeforeAfterSteps]:

18:17:54,805 INFO (main) [BeforeAfterSteps]: >>Iniciando Aplicação<< Starting ChromeDriver (v2.9.248315) on port 9576 log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Running story stories\search.storyConverted Funcionalidade: Acesso (stories\search.storyConverted) Narrative: In order to a tela inicial apareceça para mim As a visitante I want to acessar o Google Scenario: Acesso ao Google Dado que vou para a tela "Tela de Busca" Então será exibido "Google"

Scenario: Pesquisa Simples Dado que vou para a tela "Tela de Busca" 18:18:03,772 INFO (pool-1-thread-1) [ScreenShootingMaker]: Screenshot [https://www.google.com.br/] salvo em [C:\Users\01069360503\workspace\exemplo\target\jbehave/view/screenshots/failed-scenario-e4b2b97a-8b56-45a0-b340-ef28847a8e40.png] com [30.469] bytes Quando informo "Demoiselle Behave" no campo "Campo de Busca" (FAILED) (java.lang.reflect.UndeclaredThrowableException) Então será exibido "https://github.com/demoiselle/behave" (NOT PERFORMED)

Failed to run story stories\search.storyConverted java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy14.sendKeys(Unknown Source) at br.gov.frameworkdemoiselle.behave.parser.jbehave.CommonSteps.inform(CommonSteps.java:207) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jbehave.core.steps.StepCreator$ParameterisedStep.perform(StepCreator.java:550) at org.jbehave.core.embedder.StoryRunner$FineSoFar.run(StoryRunner.java:499) at org.jbehave.core.embedder.StoryRunner.runStepsWhileKeepingState(StoryRunner.java:479) at org.jbehave.core.embedder.StoryRunner.runScenarioSteps(StoryRunner.java:443) at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:305) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:219) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:180) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:201) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at br.gov.frameworkdemoiselle.behave.internal.ui.UIProxy.invoke(UIProxy.java:35) ... 19 more Caused by: org.openqa.selenium.WebDriverException: unknown error: unknown WebDriver key(57345) at string index (19) (Session info: chrome=32.0.1700.107) (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 39 milliseconds Build info: version: '2.37.1', revision: 'a7c61cbd68657e133ae96672cf995890bad2ee42', time: '2013-10-21 09:08:07' System info: host: 'SERPRO1541809V1', ip: '10.32.113.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51' Session ID: 5eaade08d319a9e14b03cb6f8a27b7ac Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\010693~1\AppData\Local\Temp\scoped_dir3512_5168}, rotatable=false, locationContextEnabled=true, version=32.0.1700.107, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268) at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89) at br.gov.frameworkdemoiselle.behave.runner.webdriver.ui.WebTextField.sendKeysWithTries(WebTextField.java:85) at br.gov.frameworkdemoiselle.behave.runner.webdriver.ui.WebTextField.sendKeys(WebTextField.java:53) ... 24 more

(AfterStories) 18:18:05,216 INFO (main) [BeforeAfterSteps]: >>Finalizando Aplicação<<

Generating reports view to 'C:\Users\01069360503\workspace\exemplo\target\jbehave' using formats '[defaultstoryreport, console, html, stats]' and view properties '{defaultFormats=stats, decorateNonHtml=true, viewDirectory=view, decorated=ftl/jbehave-report-decorated.ftl, reports=ftl/jbehave-reports-with-totals.ftl, maps=ftl/jbehave-maps.ftl, navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl}' Reports view generated with 0 stories (of which 0 pending) containing 0 scenarios (of which 0 pending) 18:18:05,691 INFO (main) [JBehaveParser]: Finalizando Parser JBehave... 18:18:05,691 INFO (main) [BehaveContext]: -------------------------------- 18:18:05,691 INFO (main) [BehaveContext]: Demoiselle Behave Finalizado 18:18:05,691 INFO (main) [BehaveContext]: --------------------------------

rogernobre commented 10 years ago

Possivelmente "chromedriver" incompatível. Alguém poderia indicar outro site onde possa usar outro "chromedriver"?

botelhojp commented 10 years ago

@rogernobre, você utilizou a versão 2.9 (http://chromedriver.storage.googleapis.com/2.9/chromedriver_win32.zip) ? Ela é a última versão publicada em 01/02/2014. Se sim, experimente testar com versões anteriores. Lembro também que esta versão é para 32bits

rogernobre commented 10 years ago

@botelhojp, usei sim. Antes eu usava uma versão 32 bits mesmo e funcionava bem (pois não tem uma versão para 64 bits para windows).

rogernobre commented 10 years ago

Tem alguém que use alguma versão do windows 64 bits que funcione o Chrome?

botelhojp commented 10 years ago

Se nenhum de nós tiver solução, o fórum mais apropriado será do próprio chromedriver (http://stackoverflow.com/questions/tagged/chromedriver) Vi uma questão similar, mas sobre a versão do Windows 8 para 64 bits.

rogernobre commented 10 years ago

A solução apresentada pelo site acima é atualizar o driver.

Estava investigando aqui e percebi que a versão do Chrome que estou rodando é 32 bits rodando em cima de um SO de 64 bits. Deveria funcionar com a versão 2.9 do driver (vou aumentar o timeout inicial para ver). Com o IE consigo rodar tanto em 32 bits como em 64 bits.

rogernobre commented 10 years ago

Coloquei um timeout antes de iniciar o primeiro cenário (com o navegador já iniciado) usando a versão 2.9 do driver mas nada:

16:02:42,685 INFO (main) [BehaveContext]: -------------------------------- 16:02:42,685 INFO (main) [BehaveContext]: Demoiselle Behave Iniciado 16:02:42,685 INFO (main) [BehaveContext]: -------------------------------- 16:02:42,779 INFO (main) [JBehaveParser]: Configurando Parser JBehave... 16:02:42,826 INFO (main) [JBehaveParser]: Iniciando Parser JBehave... 16:02:42,826 INFO (main) [JBehaveParser]: Executando história: [[stories\search.storyConverted]] Processing system properties {} Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=true,verboseFailures=true,verboseFiltering=false,storyTimeoutInSecs=3600,threads=1]

(BeforeStories) 16:02:43,030 INFO (main) [BeforeAfterSteps]:

16:02:43,030 INFO (main) [BeforeAfterSteps]: >>Iniciando Aplicação<< Starting ChromeDriver (v2.9.248315) on port 13917 log4j:WARN No appenders could be found for logger (org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Running story stories\search.storyConverted Funcionalidade: Acesso (stories\search.storyConverted) Narrative: In order to a tela inicial apareceça para mim As a visitante I want to acessar o Google Scenario: Acesso ao Google Dado que vou para a tela "Tela de Busca" Então será exibido "Google"

Scenario: Pesquisa Simples Dado que vou para a tela "Tela de Busca" Quando informo "Demoiselle Behave" no campo "Campo de Busca" (FAILED) (java.lang.reflect.UndeclaredThrowableException) 16:03:13,861 INFO (pool-1-thread-1) [ScreenShootingMaker]: Screenshot [https://www.google.com.br/] salvo em [C:\Users\01069360503\workspace\exemplo\target\jbehave/view/screenshots/failed-scenario-7cc62981-31e3-4e7e-a777-ecc89dce4bf2.png] com [30.469] bytes Então será exibido "https://github.com/demoiselle/behave" (NOT PERFORMED)

Failed to run story stories\search.storyConverted java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy15.sendKeys(Unknown Source) at br.gov.frameworkdemoiselle.behave.parser.jbehave.CommonSteps.inform(CommonSteps.java:207) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jbehave.core.steps.StepCreator$ParameterisedStep.perform(StepCreator.java:550) at org.jbehave.core.embedder.StoryRunner$FineSoFar.run(StoryRunner.java:499) at org.jbehave.core.embedder.StoryRunner.runStepsWhileKeepingState(StoryRunner.java:479) at org.jbehave.core.embedder.StoryRunner.runScenarioSteps(StoryRunner.java:443) at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:305) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:219) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:180) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:201) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at br.gov.frameworkdemoiselle.behave.internal.ui.UIProxy.invoke(UIProxy.java:35) ... 19 more Caused by: org.openqa.selenium.WebDriverException: unknown error: unknown WebDriver key(57345) at string index (19) (Session info: chrome=32.0.1700.107) (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 36 milliseconds Build info: version: '2.37.1', revision: 'a7c61cbd68657e133ae96672cf995890bad2ee42', time: '2013-10-21 09:08:07' System info: host: 'SERPRO1541809V1', ip: '10.32.113.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51' Session ID: e8fa6fc384f73706904c9ac203ae7c42 Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\010693~1\AppData\Local\Temp\scoped_dir3628_13079}, rotatable=false, locationContextEnabled=true, version=32.0.1700.107, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268) at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89) at br.gov.frameworkdemoiselle.behave.runner.webdriver.ui.WebTextField.sendKeysWithTries(WebTextField.java:85) at br.gov.frameworkdemoiselle.behave.runner.webdriver.ui.WebTextField.sendKeys(WebTextField.java:53) ... 24 more

(AfterStories) 16:03:15,389 INFO (main) [BeforeAfterSteps]: >>Finalizando Aplicação<<

Generating reports view to 'C:\Users\01069360503\workspace\exemplo\target\jbehave' using formats '[defaultstoryreport, console, html, stats]' and view properties '{defaultFormats=stats, decorateNonHtml=true, viewDirectory=view, decorated=ftl/jbehave-report-decorated.ftl, reports=ftl/jbehave-reports-with-totals.ftl, maps=ftl/jbehave-maps.ftl, navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl}' Reports view generated with 0 stories (of which 0 pending) containing 0 scenarios (of which 0 pending) 16:03:15,787 INFO (main) [JBehaveParser]: Finalizando Parser JBehave... 16:03:15,787 INFO (main) [BehaveContext]: -------------------------------- 16:03:15,803 INFO (main) [BehaveContext]: Demoiselle Behave Finalizado 16:03:15,803 INFO (main) [BehaveContext]: --------------------------------

rogernobre commented 10 years ago

A questão é o driver.

Este código dá o seguinte erro:

 public static void main(String[] args) {

        System.setProperty("webdriver.chrome.driver", BehaveConfig.getProperty("behave.runner.screen.driverPath"));

        ChromeDriver driver = new ChromeDriver();

        driver.navigate().to("http://www.google.com.br/");

        driver.findElementByName("q").sendKeys("behave");

        driver.close();
    }
Exception in thread "main" org.openqa.selenium.WebDriverException: chrome not reachable
  (Session info: chrome=32.0.1700.107)
  (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.51 seconds
Build info: version: '2.37.1', revision: 'a7c61cbd68657e133ae96672cf995890bad2ee42', time: '2013-10-21 09:08:07'
System info: host: 'SERPRO1541809V1', ip: '10.32.113.15', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Session ID: e8c246d6f5bacf7684eeb28dc37ba63c
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\010693~1\AppData\Local\Temp\scoped_dir2900_13385}, rotatable=false, locationContextEnabled=true, version=32.0.1700.107, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)
    at org.openqa.selenium.remote.RemoteWebDriver.close(RemoteWebDriver.java:418)
    at br.gov.serpro.exemplo.MyTest.main(MyTest.java:42) 

Tem que ver se tem alguém que use o SO 64 bits rodando o Chrome 32 bits.

rogernobre commented 10 years ago

Agora ferrou, até no Chromium no Ubuntu não consigo rodar.

A mesma coisa quando vai fazer um sendKeys dar erro (mesmo usando o webdriver puro)

Alguém tem o driver aí que consiga rodar no Ubuntu 10.04 32 bits?

botelhojp commented 10 years ago

Segue a versão que utilizamos: https://www.dropbox.com/sh/1sr7k89bnjzhtqc/vLJ6VqXLDO

rogernobre commented 10 years ago

@botelhojp, funcionou aqui (Ubuntu + Chromium), mas tem um porém.

Executei este trecho:

 public static void main(String[] args) {

        System.setProperty("webdriver.chrome.driver", BehaveConfig.getProperty("behave.runner.screen.driverPath"));

        ChromeDriver driver = new ChromeDriver();

        driver.navigate().to("http://www.google.com.br/");

        driver.findElementByName("q").sendKeys("behave");

        driver.close();
    }

Em modo debug, passo a passo, ele funcionou.

Mas fora disso, erro ao executar algum sendKeys.

botelhojp commented 10 years ago

Não seria algum problema de wait? Quando você roda direto no DBehave funciona?

juliancesar commented 10 years ago

@rogernobre , você conseguiu evoluir no assunto?

rogernobre commented 10 years ago

@botelhojp, quando rodo no DBehave ou fora dar o mesmo erro se no teste possuir um "sendKeys".

Testei em outra máquina (fora do serpro) a mesma coisa.

Mas com certeza é problema do driver.

Testei em uma máquina Windows 7 64 bits com o driver do site "http://chromedriver.storage.googleapis.com/index.html?path=2.9/" e aconteceu a mesma coisa

juliancesar commented 10 years ago

@rogernobre , olha o que encontrei nas issues do Chrome Driver: http://code.google.com/p/chromedriver/issues/detail?can=2&q=672&colspec=ID%20Status%20Pri%20Owner%20Summary&id=672

juliancesar commented 10 years ago

@rogernobre , fiz um resumo da atual situação da versão 1.3.2-SNAPSHOT e durante os testes verifiquei que existiam algumas incompatibilidades no framework com o Chrome que já foram resolvidas. Por favor delete os arquivos do framework do seu repositório local e faça o package do maven novamente para ele pegar as últimas versões, no caso de funcionar peço que feche esta issue.

Segue o link para o resumo de compatibilidade de navegadores que esta na Wiki: https://github.com/demoiselle/behave/wiki/Compatibilidade-de-Navegadores

Só consegui fazer testes em SOs 32-bits, mas se você conseguir fazer os testes em outros SOs peço que atualize a Wiki.

rogernobre commented 10 years ago

Funcionou.

Testes feitos no Windows 7 64 bits e no Ubuntu 10.04 32 bits.

Tudo ok. Tabela atualizada na Wiki: https://github.com/demoiselle/behave/wiki/Compatibilidade-de-Navegadores