0

我正在使用selenise runner在不同的浏览器中运行脚本。

我正在使用这个配置文件:

firefox: C://Users/Desktop/geckodriver.exe
highlight: Yes
baseurl: https://example.com/
set-speed: 1000
timeout: 30000
driver: firefox
xml-result: C://Users/Desktop/Selenise/XMLReport
html-result: C://Users/Desktop/Selenise/HTMLReport

这个命令执行 jars 和报告:

set webdriver.gecko.driver=C:\Users\Desktop\geckodriver.exe
set path=%path%;webdriver.gecko.driver;
java -jar cmdJars.jar TestCases\TestCase1.html --config config.txt --driver firefox --firefox "C://Program Files/Mozilla Firefox/firefox.exe"

我收到此错误日志:

[2017-01-17 10:34:38.139 +05:30] [INFO] Start: Selenese Runner 3.0.0
[2017-01-17 10:34:38.357 +05:30] [INFO] Firefox binary: C://Program Files/Mozill
a Firefox/firefox.exe
java.lang.IllegalStateException: The path to the driver executable must be set b
y 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:19
9)
        at org.openqa.selenium.remote.service.DriverService.findExecutable(Drive
rService.java:109)
        at org.openqa.selenium.firefox.GeckoDriverService.access$000(GeckoDriver
Service.java:37)
        at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExe
cutable(GeckoDriverService.java:95)
        at org.openqa.selenium.remote.service.DriverService$Builder.build(Driver
Service.java:296)
        at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(Firef
oxDriver.java:277)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:2
47)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:2
42)
        at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:1
35)
        at jp.vmi.selenium.webdriver.FirefoxDriverFactory.newInstance(FirefoxDri
verFactory.java:173)
        at jp.vmi.selenium.webdriver.WebDriverManager$Builder.build(WebDriverMan
ager.java:77)
        at jp.vmi.selenium.webdriver.WebDriverManager.get(WebDriverManager.java:
266)
        at jp.vmi.selenium.selenese.Main.setupRunner(Main.java:139)
        at jp.vmi.selenium.selenese.Main.run(Main.java:82)
        at jp.vmi.selenium.selenese.Main.main(Main.java:221)
[2017-01-17 10:34:38.434 +05:30] [INFO] Exit code: 1

我也设置webdriver.gecko.driver了系统环境变量。

为什么即使设置了壁虎驱动程序的路径后我也会收到此错误。

版本:Gecko 驱动程序:geckodriver 0.13.0,Selenise 亚军:Selenese 亚军 3.0.0

4

1 回答 1

0

您确定设置了 webdriver.gecko.driver 系统属性吗?

您可以将其作为 JVM 参数传递(我必须在 Mac 上传递,因为它不太喜欢环境变量中的点):

java -Dwebdriver.gecko.driver=/path/to/geckodriver -jar cmdJars.jar TestCases\TestCase1.html --config config.txt --driver firefox --firefox "C://Program Files/Mozilla Firefox/firefox.exe"

请确保 -D 出现在 -jar 之前,如上。

于 2017-03-09T02:25:36.923 回答