Displaying 6 results from an estimated 6 matches for "form_with".
2008 Nov 03
2
Multiple Submit Buttons
...ms looks just like this example.
require ''rubygems''
require ''mechanize''
a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = ''Mac Safari''
}
a.get(''http://google.com/'') do |page|
search_result = page.form_with(:name => ''f'') do |search|
search.q = ''Hello world''
end.submit
search_result.links.each do |link|
puts link.text
end
end
But now I have 2 <input type=submit.> values on my form. How can I tell
Mechanize which submit...
2010 Jan 30
0
bug or desired behaviour? couldn’t identify form using string ‘post’ but ‘POST’. html contains ‘post’ though
...''t work although the page source code says ` <form
class="login" method="post"> `
Please see more info on
http://stackoverflow.com/questions/2165834/bug-or-desired-behaviour-couldnt-identify-form-using-string-post-but-post
Thank you
Radek
`login_form = page.form_with(:method => ''post'')`
and code that works
`login_form = page.form_with(:method => ''POST'')`
I inspected the form object via `puts page.forms.inspect` and got
[#<WWW::Mechanize::Form
{name nil}
{method "POST"}
....]
-----------...
2011 Mar 27
2
LinkedIn still not working?
To clarify the issue I posted earlier:
I am on OS X 10.6.7. Trying to use Mechanize to log in to LinkedIn. As others have posted about in the past, when I submit the form it kicks me back to the LinkedIn landing page, and does not log me in.
I read the earlier discussion of the issue that mentioned how cookie values were being improperly dequoted when stored. But I thought that issue was fixed.
2009 Sep 17
1
Load Error Using Mechanize Gem
...rb:
----------------------
## Google
require ''rubygems''
require ''mechanize''
a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = ''Mac Safari''
}
a.get(''http://google.com/'') do |page|
search_result = page.form_with(:name => ''f'') do |search|
search.q = ''Hello world''
end.submit
search_result.links.each do |link|
puts link.text
end
end
----------------------
Resources I''m using:
Editor: Netbeans IDE 6.7.1
Gems installed (among others)...
2009 Sep 25
0
WWW::Mechanize and Rails console not playing well
...re ''uri''
require ''net/http''
agent = WWW::Mechanize.new { |a| a.log = Logger.new("mech.log") }
agent.user_agent_alias = ''Mac Safari''
page = agent.get(''http://www.fyi.legis.state.tx.us/Address.aspx'')
search_form = page.form_with(:name => "AddressForm")
search_form.field_with(:name => "Address1").value = "501 W 26th St,
Apt 110"
search_form.field_with(:name => "City").value = "Austin"
search_form.field_with(:name => "ZipCode").value = "78705"...
2009 Apr 09
1
undefined method ''text'' ...
...require ''rubygems''
require ''mechanize''
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...