Solucionado (ver solução)

Importante

Você está vendo a versão anterior da nova experiência da Alura que estamos preparando para você. Em breve, ela ganha uma identidade visual novinha totalmente pensada em potencializar seus estudos!

Solucionado
(ver solução)
12
respostas

Não consigo rodar o teste do vídeo 1

Boa noite, não consigo rodar o teste inicial do vídeo 1.

Aparece o erro abaixo no console, poderiam me ajudar???

Obrigado!!!

\\Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases at com.google.common.base.Preconditions.checkState(Preconditions.java:199) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109) at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:38) at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:91) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296) at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:244) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:219) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:214) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:210) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:123) at TesteAutomatizado.main(TesteAutomatizado.java:10)\\

12 respostas

Com a versão nova do selenium, você precisa fazer isso antes de chamar o driver:

 System.setProperty("webdriver.gecko.driver", "C:\GeckoDriver\geckodriver.exe");

Ou no diretório que você tiver o geckodriver!

antes do "submit"??? Seria isso???

Não tenho o "geckodriver"! :/

pode baixar aqui:

https://github.com/mozilla/geckodriver/releases

vamos atualizar no texto do curso

Obrigado, Paulo!!! ;)

Posso colocar o Geckodriver na pasta da lib???

solução!

Pode

ai lembra de refletir isso por aqui:

System.setProperty("webdriver.gecko.driver", "C:\workspace\projeto\lib\geckodriver.exe");

Mas o System entra instanciado???

Oi Jorge

A classe system possui apenas atributos e método estáticos, entao voce faz o acesso ao out, que é um atributo publico estático, sem instanciar System mesmo, como como no capítulo de static do curso de Java II

Muito obrigado, Paulo. Rodou!!!!

Boa noite!

Estou tentando rodar o Selenium fo firefox, mas o erro abaixo aparece:

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024M; support was removed in 8.0 1507515547674 geckodriver INFO geckodriver 0.19.0 1507515547680 geckodriver INFO Listening on 127.0.0.1:1581 Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:40.131Z' System info: host: 'rafael-Linux', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-59-generic', java.version: '1.8.0_111' Driver info: driver.version: FirefoxDriver remote stacktrace: stack backtrace: 0: 0x4f388c - backtrace::backtrace::trace::h736111741fa0878e 1: 0x4f38c2 - backtrace::capture::Backtrace::new::h63b8a5c0787510c9 2: 0x442c61 - webdriver::error::WebDriverError::new::hc4fe6a1ced4e57dd 3: 0x443dc6 - geckodriver::marionette::MarionetteHandler::create_connection::hf8b6061dba65cdd0 4: 0x42ac91 - >::run::hba9181b5aacf8f04 5: 0x402c59 - std::sys_common::backtrace::rust_begin_short_backtrace::h19de262639927233 6: 0x40c065 - std::panicking::try::do_call::h6c1659fc4d01af51 7: 0x5e38ec - panic_unwind::rust_maybe_catch_panic at /checkout/src/libpanic_unwind/lib.rs:98 8: 0x420d32 - >::call_box::h953e5f59694972c5 9: 0x5dc00b - alloc::boxed::{{impl}}::call_once<(),()> at /checkout/src/liballoc/boxed.rs:661 - std::sys_common::thread::start_thread at /checkout/src/libstd/sys_common/thread.rs:21 - std::sys::imp::thread::{{impl}}::new::thread_start at /checkout/src/libstd/sys/unix/thread.rs:84 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57) at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104) at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:140) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:120) at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:98) at TesteAutomatizado.main(TesteAutomatizado.java:11)

O código que estou usando é o :

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver;

public class TesteAutomatizado {

public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "/home/rafael/workspace/testes-de-sistema/lib/geckodriver");

WebDriver driver = new FirefoxDriver();

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

WebElement campoDeTexto = driver.findElement(By.name("q")); campoDeTexto.sendKeys("Caelum");

campoDeTexto.submit();

}

Alguém por favor poderia me ajudar?

Obrigado. Rafael

Rafael, consegue postar isso em um novo topico? Como esse é antigo e ja esta solucionado, as pessoas acabam nao lendo e fica mais dificil de achar a solucao