mvid mvid - 1 year ago 195
HTML Question

Python Mechanize select a form with no name

I am attempting to have mechanize select a form from a page, but the form in question has no "name" attribute in the html. What should I do? when I try to use

br.select_form(name = "")

I get errors that no form is declared with that name, and the function requires a name input. There is only one form on the page, is there some other way I can select that form?

Answer Source



to select the first form

In Mechanize source,

def select_form(self, name=None, predicate=None, <b>nr=None</b>):
    nr, if supplied, is the sequence number of the form (where 0 is the
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download