webdriver_test_tools.pageobject.form module

class webdriver_test_tools.pageobject.form.InputObject(driver, input_dict)[source]

Bases: webdriver_test_tools.pageobject.base.BasePage

Page object prototype for input elements

class Type[source]

Bases: object

Set of supported input types

CHECKBOX = 'checkbox'
EMAIL = 'email'
FILE = 'file'
NUMBER = 'number'
PASSWORD = 'password'
RADIO = 'radio'
SEARCH = 'search'
TEXT = 'text'
URL = 'url'
SELECT = 'select'
TEXTAREA = 'textarea'
SUPPORTS_OPTIONS = ['select', 'radio', 'checkbox']

Input types that support the ‘options’ key

SUPPORTS_MULTIPLE = ['select', 'checkbox']

Input types that support the ‘multiple’ key


Returns the WebElement object located by self.locator

Shorthand for self.find_element(self.locator)


WebElement object for the input


Returns the list of WebElement objects located by self.locator. Used for input types that can have multiple elements corresponding to it (e.g. radios)

Shorthand for self.find_elements(self.locator)


List of WebElement objects for the inputs

set_value(value, **kwargs)[source]

Set the value of the input



The value to set it to

  • For radio elements, this should be the value attribute of the radio to select.

  • For checkbox elements, this value should be a boolean (True=checked, False=unchecked).

  • For checkbox groups, this value should be a dictionary mapping checkbox input’s value attribute to the desired checked state (True = check, False = uncheck).

  • For single select elements, this value should be the value of the option to select.

  • For multiple select elements, this value should be a list of values of the options to select.

  • For file inputs, this value should be a filepath to the desired file.

  • For other input types (text, number, etc) this should be a string representation of the values to enter into it.

Additionally accepts keyword arguments based on the type of input this InputObject represents. See the above _set methods for type-specific optional arguments


Returns the current value of the input

class webdriver_test_tools.pageobject.form.FormObject(driver)[source]

Bases: webdriver_test_tools.pageobject.yaml.YAMLParsingPageObject

Page object prototype for forms

Subclasses should set the following attributes:


The following attributes are determined based on the contents of YAML_FILE (or should be set in subclasses if YAML_FILE is None):


The following attribute is set based on the ‘inputs’ key parsed from YAML_FILE (or parsed from INPUT_DICTS, which should be set in subclasses if YAML_FILE is None):


FormObject.inputs – A dictionary mapping input names to the corresponding InputObject instances. The keys correspond with the name keys in the YAML representation of the form (or the ‘name’ keys in INPUT_DICTS if YAML_FILE is None)

If YAML_FILE is None, subclasses must set the following attribute:


FormObject.INPUT_DICTS – List of input dictionaries. These are used to initialize the InputObject instances in inputs at runtime. These dictionaries use the same syntax as YAML inputs

inputs = {}

Parse a YAML representation of the form object and set attributes accordingly

See YAML FormObjects doc for details on syntax.


file_path – Full path to the YAML file


Initialize self.inputs using values in INPUT_DICTS

fill_inputs(input_map, strict=False)[source]

Fill form inputs

  • input_map – Dictionary mapping input name key to the values to set them to. See InputObject.set_value() for value formats for different input types

  • strict – (Default = False) If True, throw an exception if a key in input_map is not a valid key in self.inputs. Otherwise throw a warning and continue


Get the current values of form inputs


name_list – (Optional) List of input names to get values for. If unspecified, will get values for all inputs


Dictionary mapping names to the value of each input


Short hand function for checking if the submit button is enabled. Useful for forms with JavaScript input validation


True if submit is enabled, False if it’s disabled


Shorthand function for scrolling to the submit button and clicking it.

If self.SUBMIT_SUCCESS_CLASS is set to a subclass of BasePage, an instance of that object will be returned