Features

This section describes all features that are shipped with this package.

Scenario Features

class balderhub.html.lib.scenario_features.HtmlPage(**kwargs)

Bases: PageFeature

The base scenario feature that describes a specific html page. You can use this feature to follow the POM (page object model) for writing your tests.

Every page is applicable to a subset of different balderhub.url.lib.utils.Url objects. You can specify this in HtmlPage.applicable_on_url_schema().

property applicable_on_url_schema: Url | List[Url]

This method needs to be overwritten by child classes. It should return one or more balderhub.url.lib.utils.Url objects that describe a schema, on which this page is applicable.

For example:

from balderhub.html.lib.scenario_features import HtmlPage
from balderhub.url.lib.utils import Url

class MyPage(HtmlPage):

    def applicable_on_url_schema(self) -> Url:
        return Url('http://example.com/article/<int:article_id>/')

This makes the page applicable on domains like http://example.com/article/1/ or also http://example.com/article/555/, but not on http://example.com/article/a/.

Returns:

a specific balderhub.url.lib.utils.Url object or a list of it

property driver: BaseWebdriverDriverClass
Returns:

returns the driver of this page

is_applicable()

Checks if this specific page can be used on the current screen. :return: True if this page object can be applied on the current screen, otherwise False