Skip to content

Add class Delegator functionality for project simplification #4

@nickbeaird

Description

@nickbeaird

The goal of this project is to make it easier to import common functionality from the Selenium WebDriver or WebElement class methods, while also respecting that this project relies on composition rather than inheritance.

After thinking about the pom-elements package for a while, I am seeing that this project is attempting to organize Selenium into the framework that we communicate browser navigation with one another in a more natural sense. For example, while often pairing with an engineer, friend, or my parter and discussing a web page, the language revolves around "open your browser to this page" (Webdriver or PageObject) and then "click an element on the Page" (Page Element...or according to Martin Fowler a method). This issue attempts to align our day-2-day communication with our web testing with our testing framework.

That said, we now have to deal with the problem of bringing through a good handful of methods from underlying driver classes to our Page Object and the Page Element, but limiting access to other functions to keep our public API clean. There are many functions to bring through on both ends, and many functions to leave out of the mix. Thus, this leaves me thinking that this should not rely on inheritance of the driver instance and look more to composition. Once composition start repeating itself so many times, we are now stuck either writing a LOT of boilerplate. super. calls to the parent class, or using something like the Delegator Pattern. However, this issue is not being inclued in the MVP yet, as I will lean on boilerplate for the MVP if that helps communicate the project goals rather than getting too caught up in pre-mature optimization.

Here is an article that I have in mind for discussing how to move forward with the Delegator pattern.
https://www.michaelcho.me/article/method-delegation-in-python

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions