Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

Erro: The path to the driver executable must be set by the webdriver.gecko.driver system property

Estou com o mesmo problema do Jefferson Junqueira de Abreu, ao tentar executar o primeiro Teste, apareceu a mensagem de erro abaixo. Qual a solução?

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

4 respostas

Boa tarde Richard,

Um colega também estava com este problema dias atrás.

Ve te ajuda esse link.

Avisa aí se der certo.

Abraço.

acrescentei o greko no path e agora esta dando um erro diferente do seu.

1512054865418    geckodriver    INFO    geckodriver 0.19.1
1512054865437    geckodriver    INFO    Listening on 127.0.0.1:7322
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:36:59.109Z'
System info: host: 'DINFO-34937', ip: '10.16.4.35', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_31'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
   0:           0x47e934 - <no info>
   1:           0x47f0a3 - <no info>
   2:           0x442511 - <no info>
   3:           0x4436da - <no info>
   4:           0x42a890 - <no info>
   5:           0x406f5e - <no info>
   6:           0x40cfc9 - <no info>
   7:           0x6bef19 - <no info>
   8:           0x420756 - <no info>
   9:           0x6b96e0 - <no info>
  10:         0x776f59cd - BaseThreadInitThunk
    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:408)
    at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
    at org.openqa.selenium.remote.W3CHandshakeResponse$$Lambda$119/1122606666.apply(Unknown Source)
    at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
    at org.openqa.selenium.remote.W3CHandshakeResponse$$Lambda$121/1390869998.apply(Unknown Source)
    at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
    at org.openqa.selenium.remote.ProtocolHandshake$$Lambda$122/1645547422.apply(Unknown Source)
    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:529)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:516)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
    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:126)
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
    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:601)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:98)
    at TesteAutomatizado.main(TesteAutomatizado.java:10)
solução!

Eu baixei o geckodriver para o C: e acrescentei a linha abaixo e o erro não apareceu mais: System.setProperty("webdriver.gecko.driver","C:\geckodriver.exe");

Ficou assim o início do código do exercício:

public class TesteAutomatizado {
    public static void main(String[] args) {
        System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe");
       WebDriver driver = new FirefoxDriver();

Resolvi utilizar o Chrome e funcionou.