擅长:python、mysql、java
<p>不幸的是,<code>WWW:Mechanize</code>没有Javascript引擎。上面写着:<a href="http://wwwsearch.sourceforge.net/mechanize/faq.html#script" rel="nofollow">http://wwwsearch.sourceforge.net/mechanize/faq.html#script</a></p>
<p>有一些解决办法,但不确定该方法是否能100%地工作。在</p>
<pre><code>#Changing the control
br.select_form(nr=0) # select the first form : try to locate your form and adapt the line
form = br.form
form['D1'] = ['3']
#Submitting the changes
request2 = form.click() # mechanize.Request object
try:
response2 = mechanize.urlopen(request2)
except mechanize.HTTPError, response2:
pass
</code></pre>
<p>另一种解决方案是自动化无头浏览器(比如<a href="http://seleniumhq.org/" rel="nofollow">Selenium</a>和{<cd2>})</p>