Search code examples
rubygoogle-chromewatirwatir-webdriverfirewatir

Error while running watir webdriver script for Chrome


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)

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