webdriver_test_tools.pageobject.modal module

class webdriver_test_tools.pageobject.modal.ModalObject(driver)[source]

Bases: webdriver_test_tools.pageobject.yaml.YAMLParsingPageObject

Page object prototype for modals

Subclasses should set the following attributes:

Variables

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

Variables
MODAL_LOCATOR = None
CLOSE_LOCATOR = None
MODAL_BODY_CLASS = None
parse_yaml(file_path)[source]

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

See YAML ModalObjects doc for details on syntax.

Parameters

file_path – Full path to the YAML file

is_displayed()[source]

Check if the modal is displayed

This method checks if the element located by MODAL_LOCATOR exists and is visible. This should be sufficient for many common implementations of modals, but can be overridden if this isn’t a reliable detection method for an implementation

Returns

True if the modal is displayed, False otherwise

click_close_button()[source]

Click the modal close button

get_modal_body()[source]

If self.MODAL_BODY_CLASS is set to a subclass of BasePage, returns an instance of that object. Otherwise, returns None