将Chrome驱动程序与WebDrive和Selenium 2.4配合使用

时间:2011-08-23 19:07:36

标签: selenium-grid

我正在尝试使用webdriver运行谷歌浏览器,但我总是收到错误

java -jar ..\..\Selenium\selenium-server-2.4.0\selenium-server-standalone-2.4.0.jar -role webdriver -hub http://localhost:4444/grid/register -Dwebdriver.chrome.driver=..\..\Selenium\Driver\GoogleChroome\chromedriver.exe

但是我收到了这个错误:

D:\PROJEKTI\crawler\WebCrawlerSuite\DLL\RunSelenium\Grid2>java -jar ..\..\Seleni
um\selenium-server-2.4.0\selenium-server-standalone-2.4.0.jar -role webdriver -h
ub http://localhost:4444/grid/register -Dwebdriver.chrome.driver=D:\PROJEKTI\cra
wler\WebCrawlerSuite\DLL\Selenium\Driver\GoogleChroome\chromedriver.exe
23.8.2011 21:04:32 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid node
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5
        at org.openqa.grid.common.CommandLineOptionHelper.getParamValue(CommandL
ineOptionHelper.java:45)
        at org.openqa.grid.common.RegistrationRequest.loadFromCommandLine(Regist
rationRequest.java:389)
        at org.openqa.grid.common.RegistrationRequest.build(RegistrationRequest.
java:351)
        at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:57)

我做错了什么?

1 个答案:

答案 0 :(得分:2)

我得到了同样的错误并通过将-Dwebdriver.chrome.driver参数移到前面来解决它

java -jar ..\..\Selenium\selenium-server-2.4.0\selenium-server-standalone-2.4.0.jar -Dwebdriver.chrome.driver=..\..\Selenium\Driver\GoogleChroome\chromedriver.exe -role webdriver -hub http://localhost:4444/grid/register