Features

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

Admin Pages

class balderhub.django.lib.pages.admin.LoginPage(**kwargs)

Bases: LoginPage

Page object representing the Django admin login page.

property btn_login: HtmlButtonElement

Returns the login submit button element.

property input_password: HtmlTextInput

Returns the password text input element.

property input_username: HtmlTextInput

Returns the username text input element.

property url: Url
Returns:

non-schema url the login page is located at

class balderhub.django.lib.pages.admin.ChangeFormPage(**kwargs)

Bases: BaseDjangoAdminPage

Page object representing a Django admin change form page for editing a single model instance.

This page is implemented according the following structure:

_images/balderhub_django_changeform.png
class InnerContent(bridge: BaseWebdriverElementBridge)

Bases: BaseMainContentContainer

Inner content container of the change form page.

property form: ChangeFormContainer

Returns the change form container element.

property h1_title: HtmlElement

Returns the main title heading element.

property h2_caption: HtmlElement

Returns the caption heading element.

property object_tools: HtmlLiElement

Returns the object tools list element.

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 breadcrumbs: BreadcrumbsContainer

Returns the breadcrumbs navigation container.

property content: InnerContent

Returns the inner content container of the change form page.

property header: DefaultAdminHeaderContainer

Returns the admin header container.

class balderhub.django.lib.pages.admin.ChangeListPage(**kwargs)

Bases: BaseDjangoAdminPage

Page object representing a Django admin change list page for listing model instances.

This page is implemented according the following structure:

_images/balderhub_django_changelist.png
class InnerContent(bridge: BaseWebdriverElementBridge)

Bases: BaseMainContentContainer

Inner content container of the change list page.

property btn_action_go: HtmlButtonElement

Returns the ‘Go’ button element for executing the selected action.

Returns the search submit button element.

property filter_sidebar: ChangeListFilterSidebar

Returns the filter sidebar container.

Returns the search input element.

property result_table: ChangeListResultTable

Returns the result table containing the listed model instances.

property select_action: HtmlSelectElement

Returns the action select dropdown element.

property span_result_count: HtmlSpanElement

Returns the span element displaying the result count.

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 breadcrumbs: BreadcrumbsContainer

Returns the breadcrumbs navigation container.

property btn_add: HtmlAnchorElement

Returns the ‘Add’ button anchor element for creating a new model instance.

property content: InnerContent

Returns the inner content container of the change list page.

property header: DefaultAdminHeaderContainer

Returns the admin header container.

class balderhub.django.lib.pages.admin.BaseDjangoAdminPage(**kwargs)

Bases: HtmlPage

Base page object representing a Django admin page with header, content and footer sections.

property content: BaseMainContentContainer

Returns the main content container of the Django admin page.

property footer: BaseFooterContainer | None

Returns the footer container of the Django admin page.

get_visible_global_errornote_elements() list[balderhub.html.lib.utils.components.html_element.HtmlElement]

Retrieves visible error note messages from the current webpage.

This method finds all elements on the webpage that match the CSS selector for paragraphs with the “errornote” class and converts them into HtmlElement objects for further processing.

Returns:

A list of HtmlElement objects representing error note messages visible on the webpage.

get_visible_global_message_elements() list[balderhub.django.lib.utils.gui.admin.message_element.MessageElement]

Retrieves all visible alert messages from the user interface.

This method identifies all alert messages currently visible in the UI by selecting elements using the specific CSS selector ul.messagelist > li and returns them as a list of Message objects.

Returns:

A list of Message objects representing visible alert messages.

get_visible_global_messages() ResponseMessageList

Retrieve and format all global error notes and messages currently visible on this page.

Combines both global error notes and messages that are visible and processes them into a consolidated response. Global error notes and messages are extracted from their corresponding elements, transformed into respective objects, and aggregated into a single list.

Returns:

A list containing all visible global error notes and messages.

property header: BaseHeaderContainer | None

Returns the header container of the Django admin page.

class balderhub.django.lib.pages.admin.IndexPage(**kwargs)

Bases: BaseDjangoAdminPage

Page object representing the Django admin index page.

class InnerContent(bridge: BaseWebdriverElementBridge)

Bases: BaseMainContentContainer

Inner content container of the index page.

get_app_list() list[balderhub.django.lib.utils.gui.admin.main_module_container.MainModuleContainer]

Returns a list of all application module containers displayed on the index page.

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 content: InnerContent

Returns the inner content container of the index page.

property header: DefaultAdminHeaderContainer

Returns the admin header container.

Scenario Features

class balderhub.django.lib.scenario_features.GeneralAdminModelConfig(**kwargs)

Bases: AbstractDataItemRelatedFeature

This class provides configuration for administrative models wherein it defines important settings, including root URL, application name in django admin pages.

property admin_root_url: Url

the root URL for administrative actions related to the model.

property app_name

the name of the application associated with the model.

property model_name

the name of the model.

Setup Features

Note

This package does not provide any setup features.