Question

I am running below script for Chrome but its showing me error while running script

require 'watir-webdriver'

b = Watir::Browser.new:chrome
b.goto 'bit.ly/watir-webdriver-demo'
b.text_field(:id => 'entry_0').set 'your name'
b.select_list(:id => 'entry_1').select 'Ruby'
b.select_list(:id => 'entry_1').selected? 'Ruby'
b.button(:name => 'submit').click
b.text.include? 'Thank you'

Getting below error for running script

C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.21.2/lib/selenium/webdr
iver/chrome/service.rb:19:in `executable_path': Unable to find the chromedriver
executable. Please download the server from http://code.google.com/p/chromedrive
r/downloads/list and place it somewhere on your PATH. More info at http://code.g
oogle.com/p/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverEr
ror)
Was it helpful?

Solution

Well, the error message says it all. You have to install chromedriver:

https://github.com/watir/watirbook/blob/master/manuscript/installation/windows.md#chrome

OTHER TIPS

You have to install/configure ChromeDriver. The following are the steps:

  1. Download chromedriver if you want to use google chrome for testing (recommended) from: http://chromedriver.storage.googleapis.com/index.html (I downloaded 2.13 version for Windows7)
  2. Place in your PATH as follow:
    Ubuntu: usr/bin
    Windows: The ruby install folder is a good place, (usually C:/ruby###)/bin

On Mac, I found that not all PATH directories worked. Pasting the file in this path (folder), however, did work for me (make sure its called 'chromedriver', not 'chromedriver2'! (happened b/c of duplicate download)

/Users/[mac_account_name]/.rvm/gems/ruby-1.9.3-p286/bin/

Obviously, I use rvm.

(be sure to restart the shell after you add it to pick up the changes)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top