import twill
twill.commands.agent("Mozilla/5.0 (Windows NT 6.2; WOW64; rv:15.0) Gecko/20120910144328 Firefox/15.0.2")
twill.commands.go('loginpage...')
twill.commands.fv("1", "txtUserName", "username")
twill.commands.fv("1", "txtPassword", "password")
# Login Page
twill.commands.submit()
# Pre Registration Report Selection
twill.commands.submit()
# Generate and download the report.
twill.commands.go("ReportGenerator.ashx")
print "Done!"
twill.commands.redirect_output('PreRegistration.xls')
#twill.commands.save_html('PreRegistration.xls')
That is what i'm attempting to use currently.
The website works as such:
- Login page redirects to another form that lets me choose the report to generate.
- I want all default choices so i just submit the page again.
- I then visit another page which generates the report and then force downloads the file.
redirect_output does not save the xls file.
save_html does save the information BUT it corrupts something and Excel is unable to read it at all. I use kdiff to checkout any differences, it claims there are lots but the data on left/right is identical, wondering if it's an issue with line-endings..etc. Not 100% sure.
I have checked the commands page on twill's website, but i'm unsure how to go about this.