如何使用镀铬驱动程序通过终端运行selenium 3.x.

kel*_*orm 5 testing selenium integration-testing selenium-chromedriver

这可能是一个简单的问题,但我找不到任何相关的信息.

我曾经以这种方式运行selenium 2.x. 我启动服务器:

java -jar selenium-server-standalone-2.53.1.jar -Dwebdriver.chrome.driver=chromedriver -browserSideLog -debug -timeout 60
Run Code Online (Sandbox Code Playgroud)

然后我运行我的测试.我使用Dart所以我这样做

pub run test test/selenium/custom_component_test.dart 
Run Code Online (Sandbox Code Playgroud)

但现在我正在尝试使用selenium 3.我已经下载了它并用新jar代替旧的终端电话,但似乎我能做到.Selenium告诉我它不知道这样的参数"-Dwebdriver.chrome.driver".在帮助中我无法看到参数来指定参数.

那么,如何用镀铬驱动器运行硒3?

dda*_*son 13

你的选择不正常. -D...是一个java运行时变量.它需要在-jar指令之前出现.

将命令更改为

java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-2.53.1.jar -browserSideLog -debug -timeout 60
Run Code Online (Sandbox Code Playgroud)

我曾经以这种方式运行selenium 2.x.

是的,我们更改了JCommander在3.0中使用的源来解析传递给jar的选项. -D指令现在被解析为你试图传递给jar的选项,就像-debug-timeout.为了使你的命令形成良好,你真的应该-D...-jar指令之前使用.