Ghost
Ghost

Reputation: 3966

Unable to start Selenium server using WebdriverIO on Windows

I'm following instructions from http://webdriver.io/guide.html

The fourth step mentions this:

java -jar -Dwebdriver.gecko.driver=./geckodriver selenium-server-standalone-3.5.3.jar

After downloading and installing Selenium and WebdriverIO for Windows, I provided the environmental path for all the drivers and executables in System Properties.

I seem to be hitting this issue after I try to execute the aforementioned command through Powershell.

PS C:\webdriverio-test> java -jar -Dwebdriver.gecko.driver=".\geckodriver.exe" .\selenium-server-standalone-3.12.0.jar
Error: Unable to access jarfile .gecko.driver=.\geckodriver.exe
PS C:\webdriverio-test> java -jar -Dwebdriver.gecko.driver=geckodriver.exe .\selenium-server-standalone-3.12.0.jar
Error: Unable to access jarfile .gecko.driver=geckodriver.exe
PS C:\webdriverio-test> java -jar -Dwebdriver.gecko.driver=geckodriver .\selenium-server-standalone-3.12.0.jar
Error: Unable to access jarfile .gecko.driver=geckodriver 
PS C:\webdriverio-test> java -jar -Dwebdriver.gecko.driver=./geckodriver .\selenium-server-standalone-3.12.0.jar
Error: Unable to access jarfile .gecko.driver=./geckodriver

If I try running standalone Selenium server without using geckodriver, it works well. However, the main intention is to make it work using geckodriver and something seems to be going wrong here.

It just worked once when I installed it yesterday, but it doesn't seem to be working now. Any pointers as to how to make this work, would be appreciable.

Contents of the directory:

PS C:\webdriverio-test> ls


    Directory: C:\webdriverio-test


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        5/31/2018   2:41 PM                node_modules
d-----        5/31/2018  10:54 AM                nssm-2.24
d-----        5/31/2018  10:40 AM                test
-a----         4/8/2018  12:49 PM        9684296 geckodriver.exe
-a----        5/31/2018   2:41 PM          50430 package-lock.json
-a----        5/30/2018   3:37 PM       23556263 selenium-server-standalone-3.12.0.jar
-a----        5/30/2018   4:16 PM            383 test.js
-a----        5/31/2018   9:31 AM            471 test_2.js
-a----        5/31/2018  10:51 AM           9875 wdio.conf.js

Thanks in advance.

Upvotes: 0

Views: 1338

Answers (1)

yong
yong

Reputation: 13722

The jar file must follow the -jar, noting allowed to insert between -jar and the jar file

Execute in Windows CMD:

java -Dwebdriver.gecko.driver=./geckodriver.exe -jar ./selenium-server-standalone-3.12.0.jar

Execute in Windows PowerShell:

java "-Dwebdriver.chrome.driver=chromedriver_2.38.exe" -jar .\selenium-server-standalone-3.12.0.jar

For PowerShell, if the name of -Dname=value includes ., you must use double quote to around the -Dname=value

Note: please use JDK 8 or above.

Upvotes: 2

Related Questions