我正在使用 Ruby 和 Mechanize GEM 来登录 TDAmeritrade 的网站。
我尝试执行:page = agent.get('https://invest.ameritrade.com/grid/p/login')
它返回 page.forms 如下:
2.0.0-p0 :049 > page.forms
=> [#<Mechanize::Form
{name nil}
{method "POST"}
{action "https://invest.ameritrade.com/grid/p/login"}
{fields
[hidden:0x5b6684a type: hidden name: mAction value: submit]
[hidden:0x5b665a2 type: hidden name: fp_browser value: ]
[hidden:0x5b66386 type: hidden name: fp_screen value: ]
[hidden:0x5b661e2 type: hidden name: fp_software value: ]
[hidden:0x5b6f36e type: hidden name: fp_timezone value: ]
[hidden:0x5b6ffb2 type: hidden name: fp_language value: ]
[hidden:0x5b6fe5e type: hidden name: fp_java value: ]
[hidden:0x5b6fcc4 type: hidden name: fp_cookie value: ]
[hidden:0x5b6fbfc type: hidden name: flashVersion value: ]
[selectlist:0x5b6f756 type: name: ldl value: main:home]}
{radiobuttons}
{checkboxes}
{file_uploads}
{buttons [button:0x5b6eafe type: submit name: value: ]}>
]
如您所见,即使可以在浏览器中的网站上看到用户名和密码字段,也不会显示它们。如何使用 Mechanize GEM ( http://mechanize.rubyforge.org/ )使用我的 Ruby 脚本登录 TDAmeritrade ?
提前致谢。