Selenium specifying path to chromedriver.exe in Ruby capybara tests
-
22-12-2019 - |
Question
We're using an Rspec - Capybara - Selenium stack to run acceptance tests.
I'd like to bundle chromedriver.exe with my app so I can control the version and use different versions between apps. Is this possible?
It seems like somewhere in my Capybara setup I should be able to specify this path, rather than relying on what's in the bin.
Solution
Yes, this is possible.
Just add your chromedriver.exe
binary to the project directory, then when you run your tests, be sure to use relative paths.
In Java, it would look something like this.
src/
main/
tests/
MyTest.java
chromedriver.exe
Then the test would look like:
...
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
...
In ruby, I assume it'd be something similar.
Also, if you intend to do something like this, i'd recommend stating the version in the executable. For example: chromedriver-2.39.0.exe