I have just installed Selenium Runner on my Mac (Mojave) but I will also later be running it on CentOS 7. Is there any way I can tell my process the path of the chromedriver when I run it from a command line? Currently, I’m running it like so …
/usr/local/bin/selenium-side-runner /tmp/0ba4e59f-53d5-43ff-b7ff-127499868cf3.side
but getting this error
● Test suite failed to run
The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
After reading the insturxctions here — https://www.seleniumhq.org/selenium-ide/docs/en/introduction/command-line-runner/ , there is much talk about adding the path to the driver in the PATH environment variable. However, I’m running my script from a separate process that’ deson’t have access to my PATH, so I’d like a bit more control over how to tell Selnium Runner where the driver is.
Edit: Using Tarun’s solution I get the following strange result …
localhost:selenium davea$ selenium-side-runner -c "chromeOptions.binary='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'" myTestFile.side
info: Running myTestFile.side
FAIL ./DefaultSuite.test.js
● Test suite failed to run
TypeError: Target browser must be a string, but is <undefined>; did you forget to call forBrowser()?
Edit 2:
Contents of my “.side.yml” file and path to chromedriver …
localhost:selenium davea$ cat .side.yml
capabilities:
browserName: 'chrome'
chromeOptions:
binary: '/Users/davea/Documents/workspace/starter_project/selenium/chromedriver_mac'
firefoxOptions:
binary: '/Users/davea/Documents/workspace/starter_project/selenium/geckodriver_mac'
localhost:selenium davea$ ls -al /Users/davea/Documents/workspace/starter_project/selenium/chromedriver_mac
-rwxr-xr-x 1 davea staff 14994520 Jun 11 19:42 /Users/davea/Documents/workspace/starter_project/selenium/chromedriver_mac
Yet I still get the same result complaining about driver can’t be found …
localhost:selenium davea$ selenium-side-runner myTestSpike.side
info: Running myTestSpike.side
FAIL ./DefaultSuite.test.js
● Test suite failed to run
The ChromeDriver could not be found on the current PATH. Please download the latest version of the ChromeDriver from http://chromedriver.storage.googleapis.com/index.html and ensure it can be found on your PATH.
3
Answers
If you see their readme they do specify how to do the same
https://www.npmjs.com/package/selenium-side-runner
You can even create a
.side.yml
and save the options thereSee my updates in the another question related to this
How do I run my selenium-side-runner to execute my test against Firefox?
If you are running in a shell you can set an env variable which will be passed into the process your run. So just do this:
You can try ChromeOptions class. You can create an instance of ChromeOptions, which has convenient methods for setting ChromeDriver-specific capabilities.
Since Selenium version 3.6.0, the ChromeOptions class in Java also implements the Capabilities interface, allowing you to specify other WebDriver capabilities not specific to ChromeDriver.
Please go through this link for much more options Capabilities & ChromeOptions
Refer this link Command line runner.
Chrome specific capabilities
If you have Chrome installed in a non-standard location on your machine you can specify the path so ChromeDriver knows where to look.
With Chrome specific capabilities you can also run the tests headlessly.