

@property
def form(self):
    "\n        This attribute points to default form.\n\n        If form was not selected manually then select the form\n        which has the biggest number of input elements.\n\n        The form value is just an `lxml.html` form element.\n\n        Example::\n\n            g.go('some URL')\n            # Choose form automatically\n            print g.form\n\n            # And now choose form manually\n            g.choose_form(1)\n            print g.form\n        "
    if (self._lxml_form is None):
        forms = [(idx, len(list(x.fields))) for (idx, x) in enumerate(self.tree.forms)]
        if len(forms):
            idx = sorted(forms, key=(lambda x: x[1]), reverse=True)[0][0]
            self.choose_form(idx)
        else:
            raise DataNotFound('Response does not contains any form')
    return self._lxml_form

dataset/ETHPy150Open lorien/grab/grab/document.py FormExtension.form/original