

def set_input(self, name, value):
    "\n        Set the value of form element by its `name` attribute.\n\n        :param name: name of element\n        :param value: value which should be set to element\n\n        To check/uncheck the checkbox pass boolean value.\n\n        Example::\n\n            g.set_input('sex', 'male')\n\n            # Check the checkbox\n            g.set_input('accept', True)\n        "
    if (self._lxml_form is None):
        self.choose_form_by_element(('.//*[@name="%s"]' % name))
    elem = self.form.inputs[name]
    processed = False
    if (getattr(elem, 'type', None) == 'checkbox'):
        if isinstance(value, bool):
            elem.checked = value
            processed = True
    if (not processed):
        if (getattr(elem, 'type', '').lower() == 'file'):
            name._file_fields[name] = value
            elem.value = ''
        else:
            elem.value = value

dataset/ETHPy150Open lorien/grab/grab/document.py FormExtension.set_input/VarMisuse@120/282 `self`->`name`