Forum: Ruby on Rails www::mechanize help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F10f95926f620318a71c102f207649b7?d=identicon&s=25 Manish Shah (Guest)
on 2006-03-22 22:35
(Received via mailing list)
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/')
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
This topic is locked and can not be replied to.