Mechanize login form

i’m gona to simulate login my ubuntu forum,here is my program

require ‘rubygems’
require ‘mechanize’
agent = Mechanize.new
page =
agent.get(‘Ubuntu中文论坛 - 用户控制面板 - 登录’)
uform = page.forms[1]
uform.username = ‘罗非鱼’
uform.password = ‘*****’
uform.action = ‘Ubuntu中文论坛 - 用户控制面板 - 登录
page = agent.submit(uform)
page.save(‘/home/pt/ubuntu’)

attention: keyword is absolutely right,here is ommitted.
i found that i haven’t longin when i open the file /home/pt/ubuntu
with firefox.
would you mind to tell me what the matter is in my program?

On Wed, Jun 16, 2010 at 12:18 AM, Pen T. [email protected] wrote:

uform.username = ‘罗非鱼’
Posted via http://www.ruby-forum.com/.

Mechanize has its own set of cookies. So you could be logged in with
Mechanize, and not logged in with Firefox. I found a blog where
tenderlove
says you can serialize cookies (
http://tenderlovemaking.com/2006/06/22/new-stuff-in-ruby-mechanize-050/),
so
there is probably a way to share them with Fx, but it might take some
effort
to find or write, I really don’t know.