Displaying 2 results from an estimated 2 matches for "form_loginname".
2006 Mar 22
0
www::mechanize help
...quire ''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/attachmen...
2009 Apr 09
1
undefined method ''text'' ...
...a = WWW::Mechanize.new
a.get(''http://rubyforge.org/'') do |page|
# Click the login link
login_page = a.click(page.links.text(/Log In/))
# Submit the login form
my_page = login_page.form_with(:action => ''/account/login.php'') do |f|
f.form_loginname = ARGV[0]
f.form_pw = ARGV[1]
end.click_button
my_page.links.each do |link|
text = link.text.strip
next unless text.length > 0
puts text
end
end
*****
with command
/opt/local/bin/ruby rubyforge.rb
but getting
rubyforge.rb:7: undefined method `t...