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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060322/7fe9a147/attachment.html