Thought I would mention something related to this problem:

On Windows systems, the Ruby one-click installer attempts to set up your
environment so that explicitly requiring rubygems in scripts is unnecessary.

The one-click installer does this by trying to set the RUBYOPT environment
variable to the value "-rubygems".

So, many (most?) folks never have to require 'rubygems' when using Watir.

But as you discovered, in some scenarios RUBYOPT is not set by the one-click
installer (not sure of the specific reasons why - maybe account permission
issues?).  At least one co-worker of mine has run into this, but I'm not
sure which specific OS and account type he was using.

Anyway, just pointing out that docs are a little sparse on this issue
because many Watir users never have to deal with it.

A side note - my info applies to:

- installing on a WinXP Pro machine as an administrator
- using the "ruby186-26.exe" installer found here:
http://rubyforge.org/frs/?group_id=167

I'm not sure if the newer versions of the one-click installer behave the
same way.

Other info:

You can see the option for enabling RubyGems support in the initial Ruby
installer dialog.  It's the "Enable RubyGems" checkbox.

Once Ruby is installed, you can "echo %RUBYOPT%" to check if the env var was
set properly.


On Wed, Apr 7, 2010 at 8:41 PM, John Williams <[email protected]> wrote:

> Solution: In Ruby 1.8.4 or later, you need to preceed the "require
> 'watir'" command with "require 'rubygems'".
>
> How frustrating that this is not pointed out in the Watir
> documentation or examples. I found the solution in another discussion
> forum.
>
> In general I'm very disappointed with the sorry state of Watir
> installation documentation, all of which seems ad hoc, poorly
> integrated and universalized, and taking for granted big steps (e.g.
> using IRB, creating scripts in .rb files, executing .rb files, etc).
> Curiously, nearly all Watir documentation jumps right from installing
> the gems to using the Watir API, ignoring such critical steps as
> opening a Command Prompt with Ruby, opening IRB, requiring rubygems,
> editing and executing a .rb file, etc. Of course the Watir
> documentation shouldn't have to explain Ruby, IRB, or any other
> integrated technology in detail, but it should give the necessary
> steps in order to successfully complete a basic Watir command for
> someone like me who wasn't familiar with Ruby or IRB and certainly has
> no clue about which gems need to be required.
>
> Cheers,
> John
>
>
> On Apr 7, 7:56 pm, John Williams <[email protected]> wrote:
> > I couldn't get FireWatir to work on Mac, so I'm trying a more basic
> > installation (I hope) of Watir with IE for Windows XP. After
> > successfully installing the latest Ruby, RubyGems, and Watir 1.6.5,
> > every Watir script I run chokes on the "require" command with the
> > error "no such file to load". This occurs whether I am executing a
> > Ruby script or typing "require 'watir'" in the IRB command line.
> > Clearly Ruby can't find "watir".
> >
> > Since Watir installed successfully, do I need to use "require"
> > commands from any particular directory?
> >
> > Any suggestions appreciated!
> >
> > Thanks,
> > John
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> You received this message because you are subscribed to
> http://groups.google.com/group/watir-general
> To post: [email protected]
>
> To unsubscribe, reply using "remove me" as the subject.
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: [email protected]

Reply via email to