0
當我在做什麼browser.submit(),它顯示這個錯誤 回溯(最近通話最後一個):Python的browser.submit()不工作
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_mechanize.py", line 541, in submit
return self.open(self.click(*args, **kwds))
File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_mechanize.py", line 528, in click
if not self.viewing_html():
File "/usr/local/lib/python2.7/dist-packages/mechanize-0.2.5-py2.7.egg/mechanize/_mechanize.py", line 443, in viewing_html
raise BrowserStateError("not viewing any document")
mechanize._mechanize.BrowserStateError: not viewing any document
的我能想到的是一個原因當我打印browser.form 則其表示
-form-urlencoded
<TextControl(username)>
<PasswordControl(password)>
<HiddenControl(AUTH_STATE=08539313-ae8d-4133-ba21-247a90668ccb) (readonly)>
<SubmitButtonControl(<None>=) (readonly)>>
可能是其在SubmitButtonControl因爲其示出了沒有。任何人都可以建議我如何解決這個問題。 在html提交按鈕的代碼是 login 如何解決這個問題?
當我使用循環,然後它打印無所以br.form ['None'] ='登錄'沒有工作。但在第二行它是urllib2.urlopen(form.click()),它工作。謝謝。 –