Skip to content

Instantly share code, notes, and snippets.

@yyyyyyuanfei
Created December 29, 2012 12:50
Show Gist options
  • Select an option

  • Save yyyyyyuanfei/4406716 to your computer and use it in GitHub Desktop.

Select an option

Save yyyyyyuanfei/4406716 to your computer and use it in GitHub Desktop.
electsys login
# encoding: utf-8
require 'mechanize'
def doit
agent = Mechanize.new
# agent.set_proxy "localhost", 8001
page = agent.get url
form = page.form("frm")
form.txtUserName = username
form.txtPwd = password
form.add_field!("Button1", "登录")
form.submit
end
def url
"http://electsys.sjtu.edu.cn/edu/"
end
def username
""
end
def password
""
end
p doit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment