Skip to content Skip to sidebar Skip to footer

Python - Fill And Submit A HTML Form

I would like to fill in and submit a form on a web page using python. The form I want to interact with has several drop down boxes which are filled using JavaScript. I have looked

Solution 1:

  1. Selenium RC or Windmill (http://www.getwindmill.com/)

  2. Examine the form's returned GET or POST values; use urllib2 to submit synthesized requests directly.


Solution 2:

The form effectively sends information back to the server (or maybe somewhere else) after you press the submit button.

I don't know how you would directly interact with the form, but you could just send the information back to the server in the same way as submitting the form would (without actually submitting it or physically pressing on things).

So for example some forms put the parameters specified in the form (and their values) at the end of the url in the HTTP request once submitting the form. Others put the parameters in the body of the HTTP request. In PHP i know that PHP automatically takes these parameters out for you (into a global array).

In this case you would simply put your own version of the parameters (names/values) in the HTTP request, by looking a what names/values there are in the forms source code.

Although the form may send its information to the server using javascript...

Sorry if that made no sense.


Post a Comment for "Python - Fill And Submit A HTML Form"