Mechanize Javascript

丶灬走出姿态 提交于 2019-12-04 17:59:34

Using mechanize-1.0.0 the following works:

 agent = Mechanize.new
 page = agent.get('http://127.0.0.1/some.aspx')

 form = page.form("aspnetForm")
 form.add_field!('__EVENTARGUMENT', 'Page$2')
 form.add_field!('__EVENTTARGET', 'ctl00$ContentPlaceHolder1$gvwSomeList')
 page = agent.submit(form) # this gets page 2

When faced with this problem, I usually use Firefox and Firebug to find out how the request is made. Using the "Net" tab, you'll be able to see the request to "list.aspx" and all of its parameters.

page.forms.first['__EVENTARUGMENT'] = '123456' // -> should be '__EVENTARGUMENT'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!