Using the super-duper ChromeDriver with Watir-WebDriver (updated)

Anyone who has used Watir-WebDriver (or WebDriver for that matter) to test Google Chrome will know that it’s been pretty unreliable, and pretty much unusable in the past… until now.

The ChromeDriver executable was released recently which enables WebDriver to control Google Chrome natively using the Wire protocol. This means your Watir-WebDriver tests will run super fast, and super reliably.

For Mac OSX:

  1. Get the latest Watir-WebDriver gem
    gem update watir-webdriver
  2. Download the ChromeDriver binary from the Chromium site, and copy it to your path (such as /usr/local/bin/)
  3. This will work with any current version of Chrome
  4. Change your Watir-WebDriver script to use :chrome and voila, super fast Chrome, with no weird first tab opened in the background. This is the key to tell if you’re doing it right, your app should appear in the first tab of Chrome, not the second.

I haven’t done this on Windows yet, so your mileage may vary, but I imagine it wouldn’t be too different.

Author: Alister Scott

Alister is an Excellence Wrangler for Automattic.

14 thoughts on “Using the super-duper ChromeDriver with Watir-WebDriver (updated)”

  1. Hi, Allister,

    I have recently started using watir for chrome web application for my project. It has not been that bad. However, while running webdriver, i have encountered following issues. As a reminder, i am doing it in Windows.

    1. Chrome shuts down when it finds any error in the ruby script so there is no way of debugging the error through application.
    2. Chrome shuts down after completion of the script. I want it to stay in the same page like IE so that i can continue coding from that page.
    3. Entering the values in Chrome seems to be really slow. Do you know any code to make it faster like they have in IE?




    1. Sorry I don’t have any answers, try the se mailing list.
      I would just use Firefox if you can.


  2. Is there any way to get it to shut up?

    I don’t want all those “Started ChromeDriver port=63336” lines in my script output.


  3. I’ve just switched to using the Chrome driver following your instructions, notice that the following line I used to resize the window in Firefox doesn’t work.


    Do you if this is supported in Chrome?


  4. I use above steps to use chrome
    but i got some errors as below

    `new’: wrong number of arguments (1 for 0) (ArgumentError)
    from check.rb:4:in `’
    What was wrong ?
    I am unable to correct it please reply………


    1. Padmakar’s error seems familiar, I think that’s what happens if you try to create a browser instance using watir-webdriver’s format (where the browser type is specified) but you are requiring watir in your scripts.. (that is, running watir, but using watir-webdriver format to create a new browser)


  5. It isn’t working anymore as explained

    Even after including the ChromeDriver in the PATH of the system, the script is not executing on Chrome browser.

    Does somebody have any latest info..


  6. I am facing issue both on Mac and WIndows. Not able to make chrome browser work with Watir-webdriver. Downloaded and installed the latest greatest version of Ruby 2.0 on both machines.
    Installed chrome driver for both MAC and Windows – 2.7 version
    checked my PATH variable and copied chrome driver to that location downloaded from (

    Getting same error when trying to launch chrome from MAC and Windows 7:

    Starting ChromeDriver (v2.7.236900) on port 9515
    iver/remote/response.rb:51:in `assert_ok’: unknown error: cannot find Chrome bin
    ary (Selenium::WebDriver::Error::UnknownError)
    (Driver info: chromedriver=2.7.236900,platform=Windows NT 6.1 SP1 x86)
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/response.rb:15:in `initialize’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/http/common.rb:59:in `new’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/http/common.rb:59:in `create_response’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/http/default.rb:66:in `request’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/http/common.rb:40:in `call’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/bridge.rb:634:in `raw_execute’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/bridge.rb:99:in `create_session’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/remote/bridge.rb:68:in `initialize’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/chrome/bridge.rb:29:in `initialize’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/common/driver.rb:37:in `new’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver/common/driver.rb:37:in `for’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.38.0/lib/s
    elenium/webdriver.rb:67:in `for’
    from C:/Ruby200/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.4/lib/watir
    -webdriver/browser.rb:46:in `initialize’
    from C:/PERSONAL/RUBY/prog2.rb:5:in `new’
    from C:/PERSONAL/RUBY/prog2.rb:5:in `’


Comments are closed.