pythontwill

Twill doesn't show forms


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


Solution

  • 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?