Sha256: 61f6727fcbc28151b7f659da357f11f7004df0b47221b3f54bf43d98270ae688

Contents?: true

Size: 439 Bytes

Versions: 10

Compression:

Stored size: 439 Bytes

Contents

$LOAD_PATH.unshift '../lib'
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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mechanize-0.1.0 examples/rubyforge.rb
mechanize-0.2.1 examples/rubyforge.rb
mechanize-0.1.1 examples/rubyforge.rb
mechanize-0.1.3 examples/rubyforge.rb
mechanize-0.2.2 examples/rubyforge.rb
mechanize-0.3.1 examples/rubyforge.rb
mechanize-0.2.0 examples/rubyforge.rb
mechanize-0.3.0 examples/rubyforge.rb
mechanize-0.2.3 examples/rubyforge.rb
mechanize-0.1.2 examples/rubyforge.rb