TestNG的不与Firefox司机工作TestNG的java.lang.IllegalStateException:Firefox浏览器
信息
- IDE:Eclipse IDE的Java开发人员
- 版本:Neon.3版本(4.6。 3)编号:20170314-1500
- OS- Windows 8.1,
- 硒罐-3.5.3,
- TestNG的JAR-TestNG的6.10
- jcommander-1.48
我创建了一个新的项目,并添加了上述项目。 当我运行下面
源代码
package com.testpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
public class test {
@Test
public void verifyTitle() {
WebDriver driver = new FirefoxDriver();
driver.get("https://www.gmail.com");
String pageTitle = driver.getTitle();
System.out.println(pageTitle);
Assert.assertEquals(pageTitle, "Gmail");
}
}
我得到下面的消息.I'm新手到TestNG的如果有人可以帮助我 创建TestNG的项目,需要的jar和解决这个问题会很有帮助。
控制台消息
[RemoteTestNG] detected TestNG version 6.10.0
[TestNG] Running:
C:\Users\KRISHNAA\AppData\Local\Temp\testng-eclipse-1071289737\testng-customsuite.xml
FAILED: verifyTitle
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:754)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:329)
at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:103)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
at com.testpackage.test.verifyTitle(test.java:11)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:756)
at org.testng.TestRunner.run(TestRunner.java:610)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================
===============================================
Suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================
[TestNG] Time taken by [email protected]: 24 ms
[TestNG] Time taken by [email protected]: 12 ms
[TestNG] Time taken by [email protected]: 64 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 8 ms
[TestNG] Time taken by [email protected]: 8 ms
[TestNG] Time taken by [email protected]: 48 ms
[Firefox浏览器不与硒网页浏览器代码开放](可能的重复https://stackoverflow.com/questions/38751525/firefox-browser-is -not-opening-with-selenium-webbrowser-code) –
[Selenium using Java - 驱动程序可执行文件的路径必须由webdriver.gecko.driver系统属性设置](https:// stackoverflow。COM /问题/ 38676719 /硒使用的Java-的路径到该驱动器可执行,必须待设置由这webdr) –