linux - 如何运行selenium-server-standalone?

时间:2017-03-21 08:08:27

标签: java linux selenium

我创建了一个.sh文件,其中包含以下内容:

java -jar selenium-server-standalone-3.3.1.jar -Dwebdriver.gecko.driver=./opt/webdrivers/geckodriver

我已经确保文件/opt/webdrivers/geckodriver有权使用chmod 770执行,我甚至将用户更改为root。

但是如果我执行我的.sh文件,这就是结果:

root@mycomputer:/opt/Selenium# ./selenium.sh
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -Dwebdriver.gecko.driver=./opt/webdrivers/geckodriver
    at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
    at com.beust.jcommander.JCommander.parse(JCommander.java:282)
    at com.beust.jcommander.JCommander.parse(JCommander.java:265)
    at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
    at org.openqa.grid.selenium.GridLauncherV3$1.setConfiguration(GridLauncherV3.java:227)
    at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:155)
    at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:75)

我做错了什么?

1 个答案:

答案 0 :(得分:1)

您必须在-jar之后立即指定参数:

java -jar -Dwebdriver.gecko.driver=./opt/webdrivers/geckodriver selenium-server-standalone-3.3.1.jar

注意:这是一个知识共享答案(share your knowledge, Q&A-style