Using Mechanize (Python) to fill form -
i want fill form on page using python mechanize , record response. how should it? when search forms on page using following code, shows form search. how should locate form name of other form fields such name, gender etc?
http://aapmaharashtra.org/join-us
code:
import mechanize br=mechanize.browser() br.open("http://aapmaharashtra.org/join-us") form in br.forms(): print "form name:", form.name print form
the form need (with id="form1"
) loaded dynamically on fly - why don't see in select_forms()
results.
by using browser developer tools may find out form loaded http://internal.aamaadmiparty.org/directory/format.aspx?master=blank
link.
here's should start then:
import mechanize br = mechanize.browser() br.open("http://internal.aamaadmiparty.org/directory/format.aspx?master=blank") br.select_form(nr=0) br.form['ctl00$maincontent$txtname'] = 'test name' # fill out other fields req = br.submit()
hope helps.
Comments
Post a Comment