K
Kevin Lee
I am struggling with Mechanize to login to my Google account. Here is
my code:
agent = WWW::Mechanize.new
page = agent.get('https://www.google.com/accounts/ServiceLogin?....')
# or http://www.google.com/calendar
google_form = page.forms[0]
google_form.fields.name("Email").first.value = 'myaddress'
google_form.fields.find {|f| f.name == 'Passwd'}.value = 'mypasswd'
pp page
results = agent.submit(google_form, google_form.buttons.first)
pp page
puts results.body
The values of the Email and Passwd fields remain empty. So it appears
to me that the code fails to login. What more should I do? Please
help!
Thanks in advance!
my code:
agent = WWW::Mechanize.new
page = agent.get('https://www.google.com/accounts/ServiceLogin?....')
# or http://www.google.com/calendar
google_form = page.forms[0]
google_form.fields.name("Email").first.value = 'myaddress'
google_form.fields.find {|f| f.name == 'Passwd'}.value = 'mypasswd'
pp page
results = agent.submit(google_form, google_form.buttons.first)
pp page
puts results.body
The values of the Email and Passwd fields remain empty. So it appears
to me that the code fails to login. What more should I do? Please
help!
Thanks in advance!