Problema com Selenium no NetBeans

1 resposta Resolvido
Luis_Prado

Estou tentando rodar um teste que usa selenium e o firefox como navegador com o netbeans e o seguinte erro ocorre! Ele fala que tem um erro no arquivo junit.xml nas linhas

138 - <testng-template test="${classname}" />

e na linha 115 - <java classname="org.testng.TestNG" dir="${work.dir}" jvm="${platform.java}" fork="true" failonerror="${java.failonerror}">

e o seguinte erro também aparece no console

Running:
Command line suite

[VerboseTestNG] RUNNING: Suite: Command line test containing 2 Tests (config: null)

[VerboseTestNG] INVOKING CONFIGURATION: Command line test - @BeforeClass TesteDois.setUp()

[VerboseTestNG] FAILED CONFIGURATION: Command line test - @BeforeClass TesteDois.setUp() finished in 0 ms

[VerboseTestNG] java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see <a href="https://github.com/mozilla/geckodriver">https://github.com/mozilla/geckodriver</a>. The latest version can be downloaded from <a href="https://github.com/mozilla/geckodriver/releases">https://github.com/mozilla/geckodriver/releases</a>

[VerboseTestNG] 	at com.google.common.base.Preconditions.checkState(Preconditions.java:199)

[VerboseTestNG] 	at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)

[VerboseTestNG] 	at org.openqa.selenium.firefox.GeckoDriverService.access$000(GeckoDriverService.java:37)

[VerboseTestNG] 	at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:95)

[VerboseTestNG] 	at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)

[VerboseTestNG] 	at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:277)

[VerboseTestNG] 	at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:247)

[VerboseTestNG] 	at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:242)

[VerboseTestNG] 	at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:238)

[VerboseTestNG] 	at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:127)

[VerboseTestNG] 	at TesteDois.setUp(TesteDois.java:22)

[VerboseTestNG] INVOKING: Command line test - TesteDois.testENovamente()

[VerboseTestNG] SKIPPED: Command line test - TesteDois.testENovamente() finished in 0 ms

[VerboseTestNG] INVOKING: Command line test - TesteDois.testENovamenteDois()

[VerboseTestNG] SKIPPED: Command line test - TesteDois.testENovamenteDois() finished in 0 ms

[VerboseTestNG] INVOKING CONFIGURATION: Command line test - @AfterClass TesteDois.tearDown()

[VerboseTestNG] FAILED CONFIGURATION: Command line test - @AfterClass TesteDois.tearDown() finished in 0 ms

[VerboseTestNG] java.lang.NullPointerException

[VerboseTestNG] 	at TesteDois.tearDown(TesteDois.java:53)

[VerboseTestNG]

[VerboseTestNG] ===============================================

[VerboseTestNG]     Command line test

[VerboseTestNG]     Tests run: 2, Failures: 0, Skips: 2

[VerboseTestNG]     Configuration Failures: 2, Skips: 0

[VerboseTestNG] ===============================================

===============================================
Command line suite
Total tests run: 2, Failures: 0, Skips: 2
Configuration Failures: 2, Skips: 0

O que faço pra corrigir?

1 Resposta

Luis_Prado
Solucao aceita

Já consegui resolver o problema! A solução foi:

System.setProperty(“webdriver.gecko.driver”, “c:/mozilladriver/geckodriver.exe”);
driver = new FirefoxDriver();

isso dentro do BeforeClass

Criado 17 de outubro de 2016
Ultima resposta 17 de out. de 2016
Respostas 1
Participantes 1