2014-12-04 40 views

回答

0
import twill 
import webbrowser 

b = twill.get_browser() 
b.go("https://accounts.coursera.org/") 
page = b.result.get_page() 
tmp_page = "tmp.html" 
with file(tmp_page, "w") as f: 
    f.write(page) 
webbrowser.open(tmp_page) 

# b.showforms() 

我得到一個網頁,上面寫着..

請使用JavaScript的現代瀏覽器能夠使用Coursera。

所以我懷疑斜紋不包括JavaScript解釋器?

+0

是的,看起來像斜紋沒有JavaScript支持 http://stackoverflow.com/questions/6202446/does-twill-run-javascript-correctly-at-all – 2014-12-05 01:04:38

+0

恥辱我越來越興奮斜紋。在python中有一些javascript實現http://stackoverflow.com/questions/7451619/is-there-a-javascript-ecmascript-implementation-written-in-python其中一個可能很容易添加。 – 2014-12-05 01:06:45

+0

ohhh我對這個Twill感到興奮......我會回去請求-_- – 2014-12-05 07:59:56