1

I'm trying to login in https://accounts.coursera.org/ using twill for python I tried this sheet of code

import twill 
b = get_browser()  
b.go("https://accounts.coursera.org/")  
b.showforms()

twill doesn't detect the form in the page and showforms methods doesn't show anything !! Is that an internal issue in twill package or I'm misssing something

aouakki
  • 310
  • 5
  • 16

1 Answers1

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()

I get a page that says..

Please use a modern browser with JavaScript enabled to use Coursera.

So I suspect that twill doesn't include a javascript interpreter?

demented hedgehog
  • 7,007
  • 4
  • 42
  • 49
  • Yep looks like twill doesn't have javascript support http://stackoverflow.com/questions/6202446/does-twill-run-javascript-correctly-at-all – demented hedgehog Dec 05 '14 at 01:04
  • Shame I was getting excited about twill. There's some javascript implementations in python http://stackoverflow.com/questions/7451619/is-there-a-javascript-ecmascript-implementation-written-in-python one of those might be easy-ish to add. – demented hedgehog Dec 05 '14 at 01:06
  • ohhh I was excited about this Twill ...I will go back to requests -_- – aouakki Dec 05 '14 at 07:59