Submitting data to HTTPS javascript

Laszlo Nagy gandalf at shopzeus.com
Wed May 14 16:36:07 EDT 2008


John Chandler wrote:
> I am trying to write a script to test certain functionality of a 
> website that requires users to login. The login page is simple, a few 
> pictures and two text bars (one for username and one for password). I 
> tried logging in with webbrowser, but that did not work because the 
> page uses javascript. I also tried using win32com though I have no 
> idea what I am doing. Any ideas?
- Use firefox :-)
- Install "LiveHTTPHeaders" http://livehttpheaders.mozdev.org/
- Open the plugin in one window and the website in another
- Enable "capture" in livehttpheaders (default)
- Login to the website
- Disable "capture" in livehttpheaders (default)
- Check the GET and POST requests in the capture log
- Try to send the same GET and POST requests from Python.
- Don't forget that most sites will also need cookies - you have to 
extract and send back cookies as needed

You do not need any GUI component for this job.

Other good things to have:

- Good knowledge of the "re" standard module, and regular expression syntax
- BeautifulSoup (especially ICanBelieveItIsBeautifulSoup...)

You might also check the "mechanoid" project. (I have never used it but 
it is said to be an automatized, controllable web browser???)

If anyone is interested, I can put up a python recipe that shows how to 
emulate a browser easily.

Best,

    Laszlo




More information about the Python-list mailing list