Skip to content
horejsek edited this page Mar 5, 2013 · 1 revision

If some element is form, it provides some more methods.

form = driver.get_elm('formid')

fill_out(data)

form.fill_out({
    'name': 'WebdriverWrapper',  # Normal input
    'type': 'testing-tool',  # Selectbox
    'is_awesome': True,  # Checkbox
    'whatever': [1, 2, 3],  # Multicheckbox
})

Method will send key TAB if element is input of type text or textarea. Purpose of this is because of onchange event - JS function registred on that event will be called after losing of focus.

fill_out_and_submit(data)

Same as fill_out, but after that calls submit.

submit()

Some forms have more buttons than one. Simple example is: one for submit and one for reset. This method firstly look for element with id "form id_submit" and click on it. Otherwise it calls WebElement's submit.

reset()

Looks for element with id "form id_reset" and clicks on it.