Action functions cause the driver to complete an action, either on an element or the browser.
These functions operate on an element or browser, and don't return.
.. function:: check()
Checks a checkbox. Always leaves the checkbox in a 'selected' state, no matter whether it was checked or unchecked when the action was performed.
- Returns
- :class:`None`
- Example
>>> browser.get_element(id="my_checkbox").check()
.. function:: click()
Clicks the element.
- Returns
- :class:`None`
- Examples
>>> browser.get_button(id="my-button").click() >>> browser.get_element(link_text="Python Package Index (PyPI)").click()
.. function:: fill(string)
Fills an input field with a string of text or filepath. Clears any existing input from the field prior to filling.
- Parameters
string: :class:`str` The text or filepath as a string. - Returns
- :class:`None`
- Examples
>>> browser.get_element(id="my_input_field").fill("my_string") >>> browser.get_input(label="Attach file").fill("my_filepath")
.. function:: quit()
Quits the browser. Operates on a browser, not an element.
- Returns
- :class:`None`
- Example
>>> browser.quit()
.. function:: screenshot(filepath)
Takes a screenshot of either the full browser or an element, and saves it to a given filepath.
- Parameters
filepath: :class:`str` The full filepath, as a string. - Returns
- :class:`None`
- Examples
>>> browser.get_element(id="screenshot").screenshot("element.png") >>> browser.screenshot("page.png")
.. function:: select()
Selects a radio button, select option, or checkbox element. Always leaves the target element in a selected state, no matter whether it was already selected.
- Returns
- :class:`None`
- Example
>>> browser.get_element(id="my_radio_button").select()
.. function:: uncheck()
Unchecks a checkbox. Always leaves the checkbox in a 'not selected' state, no matter whether it was checked or unchecked when the action was performed.
- Returns
- :class:`None`
- Example
>>> browser.get_element(id="my_checkbox").uncheck()
.. function:: visit()
Visits a url in the browser.
- Parameters
url: :class:`str` The URL as a string. - Returns
- :class:`None`
- Example
>>> browser.visit("https://redandblack.io")