想使用 ruby mechanize 登陆这个网站 http://www.microbell.com/。本人菜鸟,文档也看不大懂。。。求教各位大神应该怎么办。万分感谢。。继续去摸索
我只能照葫芦画瓢做到这样...
require 'mechanize' a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' } a.get('http://www.microbell.com/toploginnew.asp') do |page| page.form_with(action: "toploginnew.asp?action=login") do |f| f.name = "rubychina" f.pwd = "123456" end.click_button end
#1 楼 @blacktulip 你好,谢谢你的帮助 我按照你的程序, 做了如下修改
require 'mechanize' agent = Mechanize.new page = agent.get('http://www.microbell.com/toploginnew.asp') page.form_with(action: "toploginnew.asp?action=login") do |f| f.name = "name" f.pwd = "pwd" end login_page = page.form_with(action: "toploginnew.asp?action=login").submit
请问 login_page 是不是就是登陆后的界面?谢谢。
请问如何安装 mechanize?