Željko Filipin's Blog on Software and Testing

Test like you do not need the money.

Watir on WebDriver

with 39 comments


Instructions on this page are obsolete. Please find up to date detailed instructions for Windows, Mac and Linux in my watir book.

Jari Bakken just released Watir on WebDriver.


One-Click Installer (old)

On Windows, install it with

gem install watir-webdriver

and use it with

require "rubygems" # optional
require "watir-webdriver"
browser = Watir::Browser.new(:firefox)

Supported browsers are Internet Explorer (:ie, :internet_explorer), Firefox (:ff, :firefox), Chrome (:chrome) and RemoteWebDriver Server (:remote).


Install RubyInstaller, DevKit and all required gems and it just works!

gem install watir-webdriver


My Mac came with Ruby and RubyGems installed, so it was just:

sudo gem install watir-webdriver



My Ubuntu did not have Ruby and RubyGems installed.

Install Ruby with:

sudo apt-get install ruby-full

You can install RubyGems with:

sudo apt-get install rubygems

but Jari said it would be better to install it from source. Downland the latest RubyGems tgz or zip file (rubygems-1.3.5.tgz and rubygems-1.3.5.zip at the moment), extract it, open Terminal in extracted folder and run:

sudo ruby setup.rb

Install watir-webdriver:

sudo gem1.8 install watir-webdriver


Please see Installing Watir-Web Driver on Fedora Linux

Written by Željko Filipin

January 12th, 2010 at 6:03 pm

Posted in Watir

39 Responses to 'Watir on WebDriver'

Subscribe to comments with RSS or TrackBack to 'Watir on WebDriver'.

  1. If you really want to live on the edge, how about trying it with RubyInstaller 1.8.6 [mingw32]?


    13 Jan 10 at 7:58 pm

  2. Steve, you are always full of good ideas. :) Will try tomorrow.

    Željko Filipin

    13 Jan 10 at 11:26 pm

  3. What does your gem list look like for 1.8.6 [i386-mingw32]? I tried running a simple script, but it’s failing on loading watir-webdriver (it can’t find it).

    I installed the three gems you mentioned for RubyInstaller.


    14 Jan 10 at 9:16 pm

  4. >ruby -v
    ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]
    >gem list
    *** LOCAL GEMS ***
    ffi (0.5.4)
    json_pure (1.2.0)
    rake (0.8.7)
    selenium-webdriver (0.0.14)
    watir-webdriver (0.0.1.dev)
    win32-api (1.4.5)
    win32-process (0.6.2)
    windows-api (0.4.0)
    windows-pr (1.0.8)

    Željko Filipin

    15 Jan 10 at 2:29 pm

  5. Steve, maybe you need to require rubygems.

    Željko Filipin

    15 Jan 10 at 6:55 pm

  6. Hmmm weird. It worked, but why? I thought I read something against requiring rubygems.


    15 Jan 10 at 11:09 pm

  7. Really? As far as I know requiring rubygems can not do any harm. In some implementations rubygems is already required, so you do not have to do it yourself.

    Željko Filipin

    15 Jan 10 at 11:18 pm

  8. Here’s the response article that points to the original for requiring rubygems: http://blog.mmediasys.com/2009/12/30/to-require-or-not-require-rubygems-in-your-applications-or-libraries/


    16 Jan 10 at 11:12 pm

  9. I have read the article and posts linked from it, and if you do not want to require rubygems, fell free to use solutions provided there. :)

    Željko Filipin

    18 Jan 10 at 2:34 pm

  10. Yeah, I just need to figure out what it’s complaining about ;-)


    19 Jan 10 at 10:13 pm

  11. I got super excited about this, but realized that Watir::Browser.attach was not working. Too bad, because I need attach support in the web apps I work on.

    I found this selenium issue that appears to describe the problem – I guess this means it’s a WebDriver issue rather than a watir-webdriver issue? Hopefully it will get fixed eventually…



    22 Jan 10 at 6:54 pm

  12. Yes, as far as I remember, Jari said attach is not working because WebDriver does not support it yet.

    Željko Filipin

    22 Jan 10 at 7:06 pm

  13. [...] January 28, 2010, Alan Baird (<alan_baird>) and Jari Bakken (<jarib>) had a chat about watir-webdriver on #watir IRC channel at freenode.net. Published with permission. [14:29] <alan_baird> [...]

  14. What do you need to do to get the remote web driver server working?

    Alister Scott

    8 Apr 10 at 11:07 am

  15. Alister, I did not play with remote server. It would be the best to ask at Webdriver or Selenium lists.

  16. Hi Željko Filipin,

    Thanks for your help.
    Could work in chrome with the help of Webdriver:).


    21 Apr 10 at 7:54 am

  17. Godwin, I am glad I could help. :)

    Željko Filipin

    21 Apr 10 at 10:12 am

  18. I have followed the install instructions as above and verified that I have the gems for watir-webdriver & selenium-webdriver in my ruby folder.

    I am using
    require ‘rubygems’
    require ‘watir-webdriver’

    browser = Watir::Browser.new(:chrome)

    and I get the error message:
    C:/Ruby/lib/ruby/gems/1.8/gems/watir-webdriver-0.0.1.dev5/lib/watir-webdriver/exception.rb:8: superclass mismatch for class UnknownObjectException (TypeError)
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
    from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require’
    from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in’
    from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require’
    from C:/Ruby/lib/ruby/gems/1.8/gems/watir-webdriver-0.0.1.dev5/lib/watir-webdriver.rb:6
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
    from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require’
    from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in’
    from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require’
    from test.rb:8

    any ideas?

    Stuart Alexander

    5 May 10 at 5:47 pm

  19. Stuart,

    This is not the best place for your question. Please take a look at these:


    Željko Filipin

    6 May 10 at 1:53 pm

  20. If you have somewhere else in your code:
    require ‘watir’

    you will get a superclass mismatch.

    Try opening a new irb session and:
    require ‘watir-webdriver’

    That should work, if not you have a different problem


    15 Jun 10 at 10:35 pm

  21. Thanks Steve, I have forwarded your comment to Stuart.

    Željko Filipin

    16 Jun 10 at 9:35 am

  22. [...] 7:15 – Zeljko’s blog post on Webdriver installation [...]

  23. [...] Explorer to work, I came across watir-webdriver. There’s a great guide for setting it up here. I managed to get it to run a google search in Chrome, however when it came to a Zoombu search it [...]

  24. Hi,

    I installed watir-webdriver gem.
    When i ran the script, i am getting an “Extension error” pop up and chrome browser opens indicating chromeDriver server started..

    But it is not navigating to the desired web page.

    Windows xp
    ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

    Sample script which i ran:
    #require “rubygems”
    require “watir-webdriver”

    browser = Watir::Browser.new(:chrome)
    browser.goto “http://google.com”
    browser.text_field(:name, ‘q’).set “watir-webdriver”
    browser.button(:name, ‘btnG’).click


    19 Jul 10 at 8:55 pm

  25. Hi Abhishek, I have no idea why your script does not work. If you want an answer you should post your question at webdriver, watir-webdriver or watir support forums. Let me know if you can not find them.

    Željko Filipin

    23 Jul 10 at 11:08 pm

  26. Hello,
    Could you tell me what code did you use to test the webdriver on safari on Mac.



    2 Aug 10 at 9:44 pm

  27. JD, as far as I know Safari on Mac is not supported. You should ask here: http://seleniumhq.org/support/

    Željko Filipin

    3 Aug 10 at 9:54 am

  28. [...] Jari Bakken just released pre-release of Watir-Webdriver (install instructions at Watir on WebDriver) [...]

  29. [...] to support this newer approach. For installation instructions of Watir on top of WebDriver there is a good post on the topic by Željko Filipin. There’s also some musings on the ‘why’ of [...]

  30. To install the webdriver on Ubuntu 10.10 64bit I did the following,

    sudo apt-get install ruby-full
    sudo apt-get install rubygems
    sudo gem1.8 install watir-webdriver


    27 Oct 10 at 12:18 pm

  31. Alastair,

    Thanks for letting me know. I have just started to update the post with the information you have provided, and I see that I already have `sudo apt-get install ruby-full`. :)

    Željko Filipin

    27 Oct 10 at 12:24 pm

  32. As of selenium-webdriver 0.0.29, win32-process is no longer needed on Windows.


    24 Nov 10 at 12:55 am

  33. Jari, thanks for letting me know, I have removed win32-process.

    Željko Filipin

    24 Nov 10 at 1:26 pm

  34. [...] that option again-. So we’ll uninstall firewatir and then install watir-webbriver (detailed install instructions) using the command shell: $ sudo gem uninstall firewatir $ sudo apt-get install [...]

  35. Hi,

    I am using watir with firefox on windows 7. And I would like to start using watir webdriver.

    What is not clear for me: do i have to unistall JSSH firtst.

    I have installed the watir webdriver; and i have that sample that I would like to make t running in IE

    require ‘watir’
    require “rubygems”
    require “watir-webdriver”

    #Watir::Browser.default = “firefox”
    #browser = Watir::Browser.new(:firefox)
    browser = Watir::Browser.new(:internet_explorer)
    # browser = Watir::Browser.new(:chrome)

    browser.text_field(:name, “q”).set(“pickaxe”)
    browser.button(:value, “Google Search”).click

    But I am receiving:

    C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:274:in `activate’: can’t activate ffi (>= 1.0.7, runtime) for ["selenium-webdriver-0.2.0", "watir-webdriver-0.2.2"], already activated ffi-0.6.3-x86-mingw32 for ["childprocess-0.1.7", "selenium-webdriver-0.2.0", "watir-webdriver-0.2.2"] (Gem::LoadError)”

    There is any conflick with selenium-webdriver is installed?


    9 May 11 at 9:55 pm

  36. Please see this page on how to get Watir support: http://watir.com/support/

    Željko Filipin

    9 May 11 at 9:59 pm

  37. Hi,

    I tried to install chrome WATIR in Windows XP, so I have first installed web driver gems and tried to run the following script,

    require ‘watir-webdriver’
    $browser = Watir::Browser.new(:chrome)
    $browser.text_field(:name, “q”).set(“Test”)
    $browser.button(:name, “btnG”).click

    but I am getting a error msg says “Unable to find the chromedriver executable”.

    anyone can help me this regard?


    19 Jul 11 at 7:06 am

  38. I do not provide Watir support here. Please see this page on how to get Watir support: http://watir.com/support/

    Željko Filipin

    20 Jul 11 at 10:49 am

Leave a Reply