g_form_id = ""
def is_form_found(form1):
return "id" in form1.attrs and form1.attrs['id'] == g_form_id
def select_form_with_id_using_br(br1, id1):
global g_form_id
g_form_id = id1
try:
br1.select_form(predicate=is_form_found)
except mechanize.FormNotFoundError:
print "form not found, id: " + g_form_id
exit()
# ... goto the form page, using br = mechanize.Browser()
# now lets select a form with id "user-register-form", and print its contents
select_form_with_id_using_br(br, "user-register-form")
print br.form
# that's it, it works! upvote me if u like
dzięki ale jest writtening pustą listę – sam