Chlenium grid 3节点

时间:2017-05-22 14:34:34

标签: selenium batch-file selenium-chromedriver selenium-grid

我的 StartSeleniumGridNode.bat 文件。

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://127.0.0.1:4444/grid/register ^
-browser "browserName=firefox,maxInstances=3,platform=WINDOWS" ^
-browser "browserName=chrome,maxInstances=2,platform=WINDOWS" -Dwebdriver.chrome.driver="D:\SeleniumGridPractice\drivers\chromedriver.exe"

这是我在控制台中收到的错误。

D:\SeleniumGridPractice>StartSeleniumGridNode.bat
D:\SeleniumGridPractice>java -jar selenium-server-standalone-3.4.0.jar -ro
le node -hub http://127.0.0.1:4444/grid/register -browser "browserName=firefox,m
axInstances=3,platform=WINDOWS" -browser "browserName=chrome,maxInstances=2,plat
form=WINDOWS" -Dwebdriver.chrome.driver="D:\SeleniumGridPractice\drivers\c
hromedriver.exe"
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown opti
on: -Dwebdriver.chrome.driver=D:\SeleniumGridPractice\drivers\chromedriver
.exe
        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$3.setConfiguration(GridLaunch
erV3.java:267)
        at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.
java:155)
        at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:75)`

D:\SeleniumGridPractice>

注意: StartSeleniumGridHub.bat 运行正常。 Firefox也没有问题。

1 个答案:

答案 0 :(得分:0)

请更改

java -jar selenium-server-standalone-3.4.0.jar -role node -hub http://127.0.0.1:4444/grid/register -browser "browserName=firefox,maxInstances=3,platform=WINDOWS" -browser "browserName=chrome,maxInstances=2,platform=WINDOWS" -Dwebdriver.chrome.driver="D:\SeleniumGridPractice\drivers\chromedriver.exe"

java -Dwebdriver.chrome.driver="D:\SeleniumGridPractice\drivers\chromedriver.exe" -jar selenium-server-standalone-3.4.0.jar -role node -hub http://127.0.0.1:4444/grid/register -browser "browserName=firefox,maxInstances=3,platform=WINDOWS" -browser "browserName=chrome,maxInstances=2,platform=WINDOWS"

再试一次。

说明:

JVM参数(以-D开头的参数)应该在-jar参数之前提供。但是,由于您在-jar之后提供它而不是将其视为JVM参数,因此将其作为命令行参数提供给selenium-server独立jar。