如何通过终端通过Chrome驱动程序运行Selenium 3.x [英] How to run selenium 3.x with chrome driver through terminal

查看:93
本文介绍了如何通过终端通过Chrome驱动程序运行Selenium 3.x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

May be it's easy question but I can't find any info about that.

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

I used to run selenium 2.x as that way. I start server:

java -jar selenium-server-standalone-2.53.1.jar -Dwebdriver.chrome.driver=chromedriver -browserSideLog -debug -timeout 60

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

And then I run my tests. I use Dart so I do

pub run test test/selenium/custom_component_test.dart 

但是现在我正在尝试使用硒3.我已经下载了它,并用新的jar替换了旧的终端调用,但看来我可以做到. Selenium告诉我它不知道这样的参数"-Dwebdriver.chrome.driver".在帮助中,我看不到用于指定参数的参数.

But now i'm trying use selenium 3. I have downloaded it and substitute my old terminal call with new jar but seems I can do it. Selenium tells me it doesn't know such parameter "-Dwebdriver.chrome.driver". And in help I can't see parameters to specify parameter.

那么,如何使用chrome驱动程序运行Selenium 3?

So, how to run selenium 3 with chrome driver?

推荐答案

您的选项不正确. -D...是一个Java运行时变量.它必须在-jar指令之前.

your options are out of order. -D... is a java runtime variable. it needs to come before the -jar directive.

将命令更改为

java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone-2.53.1.jar -browserSideLog -debug -timeout 60

我曾经那样运行selenium 2.x.

I used to run selenium 2.x as that way.

是的,我们将源更改为在3.0中使用JCommander来解析传递到jar中的选项.现在,像-debug-timeout一样,将-D指令解析为您要传递到jar中的选项.为了使命令格式正确,您确实应该在-jar指令之前使用-D....

Yes, we changed the source to use JCommander in 3.0 to parse options passed into the jar. -D directives are now parsed as options you are trying to pass into the jar, just like -debug and -timeout. For your command to be well formed, you really should be using -D... before the -jar directive.

这篇关于如何通过终端通过Chrome驱动程序运行Selenium 3.x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆