I am using Cucumber with Capybara to run automation test in Jenkins server. Everything works fine with Firefox. However, I got problem with setup Google Chrome and ChromeDriver. I have installed Google Chrome and ChromeDriver (moved chromedriver to usr/bin/chromedriver) but when the test runs, it notifies an error:
"Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver."
Below is my setup in env.rb for Chrome driver:
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome, :switches =>
%w[--ignore-certificate-errors --disable-popup-blocking])
end
How can I set path to ChromeDriver when register_driver? Have anyone experienced this issue before? Many thanks.
Go to the terminal and type the command: sudo nano /etc/paths. Enter the password. At the bottom of the file, add the path of your ChromeDriver. Type Y to save.
Now we need to move ChromeDriver somewhere that Python and Selenium will be able to find it (a.k.a. in your PATH ). The easiest place to put it is in C:\Windows . So move it there!
Default location on Windows is: C:\Program Files\(select the folder you want to put your file)\chromedriver.exe. In your Selenium code, paste the driver path correctly, for example: System.setProperty("webdriver.chrome.driver", "C:\\Program Files\\Java\\chromedriver.exe");
For selenium 3.x this Selenium::WebDriver::Chrome.driver_path = <path to chromedriver>
is deprecated. Now you have to put chrome_driver path in declaration of driver:
Capybara::Selenium::Driver.new(app, :browser => :chrome, :driver_path => <path to chromedriver>)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With