Question

Unable to find the chromedriver executable. Please download the server from http://code.google.com/p/chromedriver/downloads/list and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)

On Ubuntu 13 with Watir and Ruby.

Était-ce utile?

La solution 2

Please download the server from http://code.google.com/p/chromedriver/downloads/list and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.

UPD: Link that is not broken: https://sites.google.com/a/chromium.org/chromedriver/downloads

Autres conseils

For other people on MacOS:

brew cask install chromedriver

And you'll be good to go.

If using Homebrew 2.6.0 (released in 2020.12.01) or above, you should use:

brew install --cask chromedriver

For Linux/Ubuntu users, only running the following command should be sufficient:

sudo apt-get install chromium-chromedriver 

It takes care of addition the binary file to PATH as well.

I am considering Ruby on Rails features tests. Steps to add chromedriver to selenium webdrivers initialization:

1) Download lastest chrome executable from https://sites.google.com/a/chromium.org/chromedriver/downloads

2) Declare webdriver path in rails spec helper as (For selenium 3.x)

Selenium::WebDriver::Chrome.driver_path = "/home/jazz/Desktop/web_drivers/chromedriver"

and this should be before driver initialization like Capybara::Selenium::Driver.new(app, :browser => :chrome)

For above 3.x, just pass driver path during initialization-

Capybara::Selenium::Driver.new(app, :browser => :chrome,:driver_path => <path to chromedriver>)

All set. Load any feature spec in rails.It will open a chrome window.

It also will work to add an environment variable named webdriver.chrome.driver.

set webdriver.chrome.driver to whatever the absolute path is.

For me what have worked was to download the chromedriver.exe based on my Chrome version and place it on my directory "C:/ruby/...bin/" I've tried to setup the environment variable but it didn't work at all.

I have another solution worth trying:

in rails-helper.rb go to this line and change :firefox to :chrome

Capybara.register_driver :selenium do |app|
    Capybara::Selenium::Driver.new(app, :browser => :firefox)
end

to

Capybara.register_driver :selenium do |app|
    Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

then, go to ChromeDriver and run this:

brew tap homebrew/cask && brew cask install chromedriver

I had the same issue with Ruby and Watir. I have installed ChromeDriver according to this tutorial:

https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/

Then I had following error:

DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser

In my case error was solved by adding the arguments --no-sandbox and --disable-dev-shm-usage to browser contructor:

args = ['--no-sandbox', '--disable-dev-shm-usage']
browser = Watir::Browser.new :chrome, options: {args: args}

Finally, everything works fine.

The Chrome Drive Path changed again. The new Path which has Chrome Driver for all versions:

Working Path

  1. https://chromedriver.storage.googleapis.com/index.html

  2. https://sites.google.com/chromium.org/driver/

Old Path - https://sites.google.com/a/chromium.org/chromedriver/downloads

Include below on your env.rb

Capybara.register_driver :chrome do |app|
  Capybara::Selenium::Driver.new(app,
    :browser => :chrome,
    :driver_path => "<PATH FOR UNZIPPED DRIVER FOLDER>"
  )
end

Windows :

  1. enter the link indicated in the error message https://chromedriver.storage.googleapis.com/index.htm
  2. download chrome driver
  3. copy the chromedriver.exe file
  4. go to the c:\windows folder
  5. paste the chromedriver.exe

your code will now work.

Mac:

  1. just enter cmd and type brew cask install chromedriver

your code will now work.

Linux:

  1. just enter cmd and type sudo cp chromedriver /usr/local/bin

your code will now work.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top