Ruby - require 'watir-webdriver' - generates a LoadError no such file... Why?

Dirk picture Dirk · Nov 9, 2011 · Viewed 8k times · Source

I am new to Ruby and would really appreciate some help understanding what is going on here.
Summary:

Gem install watir-webdriver
Installs fine
start irb
require "watir-webdriver"
... LoadError: no such file to load --watir-webdriver

Surely this should respond

=> true

Why is it not finding the gem? Or what am I doing wrong?

Console

I'm on win7, Railsinstaller (Ruby 1.8.7).

Answer

Steve picture Steve · Nov 9, 2011

In 1.8.7 you need to require rubygems first.

require 'rubygems'

Some explanation here: How does require rubygems help find rubygem files?