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!
···
--
Posted via http://www.ruby-forum.com/.
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
···
On Wed, Jul 21, 2010 at 6:12 AM, Chugm 456789 <chugm456789@googlemail.com>wrote:
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!
--
Posted via http://www.ruby-forum.com/\.
Hi,
I've looked up and the name of the button is "signIn". I did a little test
here and everything went fine. Try checking the name.
···
On Thu, Jul 22, 2010 at 3:33 AM, Chugm 456789 <chugm456789@googlemail.com>wrote:
thiago damasceno wrote:
> On Wed, Jul 21, 2010 at 6:12 AM, Chugm 456789 > > <chugm456789@googlemail.com>wrote:
>
>> @agent.keep_alive = false
>> login_form.Email = account
>> Posted via http://www.ruby-forum.com/\.
>>
>>
> 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.
--
Posted via http://www.ruby-forum.com/\.
I tested this script on windows xp box with ruby 1.9.1 installation and it
seems just fine here.
···
On Thu, Jul 22, 2010 at 7:52 PM, Chugm 456789 <chugm456789@googlemail.com>wrote:
thiago damasceno wrote:
> On Thu, Jul 22, 2010 at 3:33 AM, Chugm 456789 > > <chugm456789@googlemail.com>wrote:
>
>> >
>> submit it. But it doesn't make sence anyway.
>> --
>> Posted via http://www.ruby-forum.com/\.
>>
>>
> Hi,
>
> I've looked up and the name of the button is "signIn". I did a little
> test
> here and everything went fine. Try checking the name.
Hey there,
still same problem. I now tried another OS (tested now with Win2k and
XP). Which OS you take?
--
Posted via http://www.ruby-forum.com/\.
I tested this script on windows xp with ruby 1.9.1 installation. It seems
right here
···
On Thu, Jul 22, 2010 at 7:52 PM, Chugm 456789 <chugm456789@googlemail.com>wrote:
thiago damasceno wrote:
> On Thu, Jul 22, 2010 at 3:33 AM, Chugm 456789 > > <chugm456789@googlemail.com>wrote:
>
>> >
>> submit it. But it doesn't make sence anyway.
>> --
>> Posted via http://www.ruby-forum.com/\.
>>
>>
> Hi,
>
> I've looked up and the name of the button is "signIn". I did a little
> test
> here and everything went fine. Try checking the name.
Hey there,
still same problem. I now tried another OS (tested now with Win2k and
XP). Which OS you take?
--
Posted via http://www.ruby-forum.com/\.
sorry...there's something wrong with my mail client to send so many copy of
replies..
···
On Sun, Jul 25, 2010 at 12:32 PM, Xavier Heruacles <xheruacles@gmail.com>wrote:
I tested this script on windows xp with ruby 1.9.1 installation. It seems
right here
On Thu, Jul 22, 2010 at 7:52 PM, Chugm 456789 <chugm456789@googlemail.com > >wrote:
> thiago damasceno wrote:
> > On Thu, Jul 22, 2010 at 3:33 AM, Chugm 456789 > > > <chugm456789@googlemail.com>wrote:
> >
> >> >
> >> submit it. But it doesn't make sence anyway.
> >> --
> >> Posted via http://www.ruby-forum.com/\.
> >>
> >>
> > Hi,
> >
> > I've looked up and the name of the button is "signIn". I did a little
> > test
> > here and everything went fine. Try checking the name.
>
> Hey there,
>
> still same problem. I now tried another OS (tested now with Win2k and
> XP). Which OS you take?
> --
> Posted via http://www.ruby-forum.com/\.
>
>