webdriver_test_tools.pageobject.utils.yaml module

Utilities for parsing YAML page object representations.

exception webdriver_test_tools.pageobject.utils.yaml.YAMLParseException[source]

Bases: Exception

Generic exception for parsing YAML files

exception webdriver_test_tools.pageobject.utils.yaml.YAMLKeyError[source]

Bases: webdriver_test_tools.pageobject.utils.yaml.YAMLParseException

Missing key in parsed YAML

exception webdriver_test_tools.pageobject.utils.yaml.YAMLValueError[source]

Bases: webdriver_test_tools.pageobject.utils.yaml.YAMLParseException

Invalid value in parsed YAML

webdriver_test_tools.pageobject.utils.yaml.parse_yaml_file(path)[source]

Parses a YAML file and returns a dictionary representation of it

Parameters

path – Path to the YAML file

Returns

A dictionary representation of the YAML file

webdriver_test_tools.pageobject.utils.yaml.parse_locator_dict(locator_dict)[source]

Takes a locator dictionary from a parsed YAML file and returns the locator tuple

If locator_dict is already a tuple, it will be returned as-is under the assumption that it’s already a locator. This allows non-YAML representations to just use normal locators

Parameters

locator_dict

Locator dictionary from a parsed YAML file. A valid locator dict must have the following keys:

  • ’by’: name of attribute from selenium.webdriver.common.by.By

  • ’locator’: locator string

Note

The string mapped to the ‘by’ key will be capitalized before checking if it’s a valid attribute of the By class

Returns

Parsed WebDriver locator tuple