mechanzie submit fails at gmail login

C

Chugm 456789

Hallo everybody,

I try to write a script that checks my gmails automatically. But when I
try to submit the login form, I get the exception 404 =>
Net::HTTPNotFound. Can anyone help?

Code is:

@LoginUrl = 'http://mail.google.com/mail/'
@agent = Mechanize.new
@agent.keep_alive = false
@agent.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; de;
rv:1.9.2) Gecko/20100115 Firefox/3.6'
@agent.follow_meta_refresh = true
@agent.redirect_ok = true
@agent.ca_file = 'cacert.pem'

login_page = @agent.get(@LoginUrl)

begin
login_form = login_page.forms.first
login_form.Email = account
login_form.Passwd = password

login_response_page = @agent.submit login_form

rescue Exception => e
print e, "\n"
end

Thanks in advance!
 
T

thiago damasceno

[Note: parts of this message were removed to make it a legal post.]

Hallo everybody,

I try to write a script that checks my gmails automatically. But when I
try to submit the login form, I get the exception 404 =>
Net::HTTPNotFound. Can anyone help?

Code is:

@LoginUrl = 'http://mail.google.com/mail/'
@agent = Mechanize.new
@agent.keep_alive = false
@agent.user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.0; de;
rv:1.9.2) Gecko/20100115 Firefox/3.6'
@agent.follow_meta_refresh = true
@agent.redirect_ok = true
@agent.ca_file = 'cacert.pem'

login_page = @agent.get(@LoginUrl)

begin
login_form = login_page.forms.first
login_form.Email = account
login_form.Passwd = password

login_response_page = @agent.submit login_form

rescue Exception => e
print e, "\n"
end

Thanks in advance!
Hi,

try this:

@agent.submit(login_form,login_form.button_with:)name => "SignIn"))

I'm not sure about the name of the button but you get the idea
 
C

Chugm 456789

thiago said:
Hi,

try this:

@agent.submit(login_form,login_form.button_with:)name => "SignIn"))

I'm not sure about the name of the button but you get the idea

Hi,

thanks for your reply. I tried it your way, bt it didn't help. Still get
the exception. Seems the agent doesn't know the form, wehn he tries to
submit it. But it doesn't make sence anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top