Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run selenium 3.x with chrome driver through terminal

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

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

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

pub run test test/selenium/custom_component_test.dart 

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.

So, how to run selenium 3 with chrome driver?

like image 763
kelegorm Avatar asked Oct 26 '16 12:10

kelegorm


1 Answers

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

Change your command to

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

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

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.

like image 162
ddavison Avatar answered Nov 17 '22 00:11

ddavison