1

I'm trying to get Chromedriver to work with my cucumber BDD/watir-webdriver setup. 1) Cucumber+ firefox: works fine 2) irb + chromedriver: works fine 3) cucumber + chromedriver : doesn't work

Here's the setup I have: Mac OSX: 10.9.5

chromedriver location:

$ which chromedriver
/usr/local/bin/chromedriver
$ ls -lart /usr/local/bin/chromedriver
lrwxr-xr-x  1 user  admin  44 Dec 11 18:08 /usr/local/bin/chromedriver -> ../Cellar/chromedriver/2.12/bin/chromedriver

Here's my env.rb entries for chrome and firefox (firefox works):

case ENV['BROWSER']
  when 'chrome'
    browser = Watir::Browser.new :chrome
  when 'firefox'
    browser = Watir::Browser.new :firefox
end

command line I use to run tests, from project directory:

"cucumber features"

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 http://code.google.com/p/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/chrome/service.rb:20:in `executable_path'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/chrome/service.rb:31:in `default_service'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/chrome/bridge.rb:14:in `initialize'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/common/driver.rb:37:in `new'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/common/driver.rb:37:in `for'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver.rb:67:in `for'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/watir-webdriver-0.6.11/lib/watir-webdriver/browser.rb:46:in `initialize'
/Users/user/Projects/new_nuvotv_automation/features/support/env.rb:57:in `new'
/Users/user/Projects/new_nuvotv_automation/features/support/env.rb:57:in `<top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/rb_support/rb_language.rb:95:in `load'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/rb_support/rb_language.rb:95:in `load_code_file'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:180:in `load_file'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:184:in `load_step_definitions'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/runtime.rb:42:in `run!'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/lib/cucumber/cli/main.rb:47:in `execute!'
/Users/user/.rvm/gems/ruby-2.0.0-p481/gems/cucumber-1.3.17/bin/cucumber:13:in `<top (required)>'
/Users/user/.rvm/gems/ruby-2.0.0-p481/bin/cucumber:23:in `load'
/Users/user/.rvm/gems/ruby-2.0.0-p481/bin/cucumber:23:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'


Process finished with exit code 1

I've also done the following:

  1. I added the chromedriver binary to a directory in the test suite project, then added the path to the binary, to the LOAD PATH; didn't fix the issue
  2. added the chromedriver path to the env.rb by adding the following: Selenium::WebDriver::Chrome.path = '/usr/local/bin/chromedriver'

This also didn't work, with exactly the same error above.

Anyone have any ideas?

1 Answer 1

1

After much searching, I found the solution, or at least got pointed in the right direction.

I edited my env.rb to include the following:

Selenium::WebDriver::Chrome::Service.executable_path = '/usr/local/bin/chromedriver' 

Cucumber now runs fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.