用笨办法解决了……
agent = Mechanize.new
page = agent.get("https://example.com/login")
login_form = page.forms.first
login_form.username = 'username'
login_form.password = 'password'
agent.submit(login_form)
page = agent.get("https://example.com/index.php")
pp page
但是还是不知道如何处理跳转
把我的程序重命名一下似乎就好了。