Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Aaron Patterson
RE: Mechanize Help [ reply ]  
2006-03-02 00:39
Works for me, here is sample code:

require 'rubygems'
require 'mechanize'
require 'logger'

@agent = WWW::Mechanize.new
@page = @agent.get("http://www.accessmedicine.com/statistics/login.aspx";)
form = @page.forms.find { |f| f.name == 'Form1' }
form.fields.find { |f| f.name == 'userName' }.value = 'myusername'

By: Andrew Croswell
Mechanize Help [ reply ]  
2006-01-19 18:27
I have successfully run the mechanize example against the RubyForge site, when I run it against a site that I need to collect data from I get the following error:
undefined method `fields' for nil:NilClass (NoMethodError)

The line in question is: form.fields.find {|f| f.name == 'userName'}.value = 'myusername'

The site is: http://www.accessmedicine.com/statistics/login.aspx

Is there a problem using mechanize with asp sites?

Thanks

Andy