webdriver_test_tools.pageobject.yaml module¶
-
class
webdriver_test_tools.pageobject.yaml.YAMLParsingPageObject(driver)[source]¶ Bases:
webdriver_test_tools.pageobject.base.BasePage,abc.ABCAbstract subclass of
BasePagewith the basic attributes and abstract method for parsing YAML representations of page objects.Since this subclasses
BasePage, prototypes that implement this only need to subclassYAMLParsingPageObject.Page object prototypes that implement this will need to set the following attribute:
- Variables
YAMLParsingPageObject._YAML_ROOT_KEY – String for the expected root key in the parsed YAML. Usually a descriptor of the prototype (e.g. ‘form’)
The abstract method
parse_yaml()is partially implemented and returns the results of parsing the YAML file and retrieving the value at_YAML_ROOT_KEY. Implementations ofparse_yaml()can callsuper().parse_yaml(file_name)to get the dictionary, e.g.:def parse_yaml(self, file_name): parsed_yaml = super().parse_yaml(file_path) ...
This class also includes the following attribute, which should be set in subclasses of the prototype classes that implement this:
- Variables
YAMLParsingPageObject.YAML_FILE – Path to a YAML file representing the page object. This file is parsed during initialization using
parse_yaml()(if it’s set)
-
_YAML_ROOT_KEY= None¶
-
YAML_FILE= None¶
-
abstract
parse_yaml(file_path)[source]¶ Partially implemented abstract method for parsing YAML representation of the page object. Implementations of this can call
super().parse_yaml(file_path)to get the value of the parsed file at_YAML_ROOT_KEY- Parameters
file_path – Full path to the YAML file
- Returns
Dictionary of parsed YAML at
_YAML_ROOT_KEY
-
no_yaml_init()[source]¶ Fallback method to call during
__init__()ifYAML_FILEis not set.Subclasses should implement this method if any part of the initialization process needs to be handled differently when
YAML_FILEis not set.
-
_abc_impl= <_abc_data object>¶