I’m using mechanize to log into this form. The redirects aren’t going
where I would expect them to though. I don’t think i’m being logged in
properly, yet when I try it through the web browser I get logged in
normal.
I’m looking for maybe a better way on how to do this, or if anyone has
an ideas.
@agent = WWW::Mechanize.new { |agent| agent.user_agent_alias = ‘Windows
Mozilla’ }
@agent.get(‘Turbify.com | Buy a Domain | Websites & Domains | Purchase a URL - Turbify’) do |page|
@login_page = page.links.text(“Small Business”).click
temp_page = @login_page.form_with(:name => ‘login_form’) do |form|
form[‘login’] = @login
form[‘passwd’] = @password
end.submit
if temp_page.uri.to_s.include?(“login”)
puts “Not logged in.”
puts “an error occured.”
exit
else
puts “Logged in”
end
end
The only thing I could think of is if the login fails, it returns me
back to a login page. This always says “Not Logged in” even though I
know the @login and @password are correct.
On another note, is there any good sites with REALLY good docs on
mechanize, and everything it can do. The main docs page seems to just
show the methods but not really what they do and how to use them.
Thanks,
~Jeremy