Forum: Ruby How to login in a page whit a ruby program

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Emmanuel C. (Guest)
on 2008-12-15 15:29
I need to make a program for login and logout in a  web site
Jason Trebilcock (Guest)
on 2008-12-15 16:15
(Received via mailing list)
On Mon, Dec 15, 2008 at 7:22 AM, Emmanuel Cruz

> I need to make a program for login and logout in a  web site
> (
> --
> Posted via
One option would be to use Watir:

That's a good starting point.
Mark T. (Guest)
on 2008-12-15 16:46
(Received via mailing list)
That's what Mechanize is for.
on 2008-12-15 19:05
(Received via mailing list)

or you can use pure net/http from the standard lib. Then you only need
managing the cookies:

1. load the login page and (if needed) extract the form data
2. create a login post reqeuest and send it, store the cookies (if
some) and send them back next time
3. now you can open the next pages as if you were logged in

That's all. Logout is simply open the logout page or send the logut
post request. Mechanize just helps you storing your cookies.
You will maybe also need something like nokogiri or hpricot for html

This topic is locked and can not be replied to.