# Www::mechanize help

**URL:** <https://www.ruby-forum.com/t/www-mechanize-help/55679>\
**Category:** Rails\
**Created:** [March 22, 2006, 10:35pm UTC](https://www.ruby-forum.com/t/www-mechanize-help/55679 "2006-03-22T22:35:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@mshah](https://www.ruby-forum.com/u/mshah)\
**Post date:** [March 22, 2006, 10:35pm UTC](https://www.ruby-forum.com/t/www-mechanize-help/55679/1 "2006-03-22T22:35:00Z")

</div>

I installed the gem for WWW::Mechanize and the installer said it  
installed  
successfully. I tried to create a test ruby script to see if it works  
and i  
get this error:

mechanize-test.rb:1:in `require’: no such file to load – mechanize  
(LoadError)  
from lib/tasks/mechanize-test.rb:1

Am i doing something wrong? What is the proper way to require external  
classes in ruby? Futhermore in a rails project? Anyone worked with  
mechanize before? please help.

Here is the test script (which i copied from the example given on the  
creator’s, Mike Neuman?, blog)

require ‘mechanize’

agent = WWW::Mechanize.new {|a| a.log = Logger.new(STDERR) }  
page = agent.get(‘[http://rubyforge.org/](http://rubyforge.org/)’)  
link = page.links.find {|l| l.node.text =~ /Log In/ }  
page = agent.click(link)  
form = page.forms[1]  
form.fields.find {|f| f.name == ‘form\_loginname’}.value = ARGV[0]  
form.fields.find {|f| f.name == ‘form\_pw’}.value = ARGV[1]  
page = agent.submit(form, form.buttons.first)  
puts page.body
