【发布时间】:2014-06-16 14:17:08
【问题描述】:
我正在尝试将 login 和 password 传递给网站的表单文本字段。
require 'mechanize'
agent = Mechanize.new
agent.get("http://zenitbet.com/").forms.first
=> #<Mechanize::Form
{name nil}
{method "POST"}
{action "index.php"}
{fields
[text:0x3fc34da544c0 type: text name: login value: ]
[field:0x3fc34da5418c type: password name: imd5 value: ]}
{radiobuttons}
{checkboxes}
{file_uploads}
{buttons [submit:0x3fc34da53d90 type: submit name: value: войти]}>
当我试图传递类似的信息时
agent.get("http://mobile.zenitbet.com/").forms.first.login = "login"
agent.get("http://mobile.zenitbet.com/").forms[0].fields[1].value = "password"
并提交
agent.get("http://mobile.zenitbet.com/").forms[0].submit
没有变化:表单不提交,页面不重定向
我错过了什么?谢谢!
【问题讨论】:
标签: ruby-on-rails ruby mechanize