Utilities
This section shows general objects and helper functions that are used with this package.
Components
- class balderhub.html.lib.utils.components.HtmlElement(bridge: BaseWebdriverElementBridge)
Bases:
AbstractElement,VisibleMixin,ClickableMixinThis is a general version of an html element. It is used as base class for all specific html elements inside this package.
The element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.
- property bridge: BaseWebdriverElementBridge
- Returns:
returns the underlying bridge object
- classmethod by_raw_element(driver: T, web_element: HtmlElement, parent: HtmlElement | BaseWebdriverElementBridge | None = None)
This method returns the html element by the raw guicontrol engine element.
- Parameters:
driver – the guicontrol driver
web_element – the raw guicontrol engine element (f.e.
WebElementif guicontrol engine isbalderhub-selenium)parent – optional a parent html element, if the selector is relative
- Returns:
the html element that is identified by the selector
- classmethod by_selector(driver: T, selector: Selector, parent: HtmlElement | BaseWebdriverElementBridge | None = None)
THis method returns the element by a provided selector.
- Parameters:
driver – the guicontrol driver
selector – the selector to identify the element
parent – optional a parent html element, if the selector is relative
- Returns:
the html element that is identified by the selector
- click()
clicks this element
- property driver: T
- Returns:
returns the underlying guicontrol driver
- exists() bool
- Returns:
returns True if this element exists, False otherwise
- is_clickable() bool
- Returns:
returns true if this element is clickable, False otherwise
- is_visible() bool
- Returns:
returns True if this element is visible, False otherwise
- property parent_bridge: BaseWebdriverElementBridge
- Returns:
returns the bridge of the paren element (if any)
- property raw_element
- Returns:
returns the raw guicontrol engine element
- property text: str
- Returns:
returns the text of the element
- class balderhub.html.lib.utils.components.HtmlAnchorElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
- class balderhub.html.lib.utils.components.HtmlBodyElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement
- class balderhub.html.lib.utils.components.HtmlButtonElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement
- class balderhub.html.lib.utils.components.HtmlDivElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDivElement
- class balderhub.html.lib.utils.components.HtmlFormElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement
- class balderhub.html.lib.utils.components.HtmlImageElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement
- class balderhub.html.lib.utils.components.HtmlLabelElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement
- class balderhub.html.lib.utils.components.HtmlLiElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLLIElement
- class balderhub.html.lib.utils.components.HtmlOlElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLOListElement
- class balderhub.html.lib.utils.components.HtmlOptionElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement
- get_value() Any
This method returns the value of the option. :return: the value of the option
- is_selected() bool
This method checks if the select option is selected :return: True if the option is selected otherwise False
- class balderhub.html.lib.utils.components.HtmlSelectElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElement,SelectByVisibleTextMixin,SelectByIndexMixin,SelectByHiddenValueMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement
- property options: list[balderhub.html.lib.utils.components.html_option_element.HtmlOptionElement]
- Returns:
returns a list with all options of this select element
- select_by_index(index: int)
This method selects the element by its index :param index: the index to select
- select_by_text(visible_text: str)
This method selects the element by visible text :param visible_text: the visible text of the element that should be selected
- select_by_value(value: str) None
This method selects the element by its value :param value: the value to select
- class balderhub.html.lib.utils.components.HtmlSpanElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLSpanElement
- class balderhub.html.lib.utils.components.HtmlTableElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement
- class balderhub.html.lib.utils.components.HtmlTablecellElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableCellElement
- class balderhub.html.lib.utils.components.HtmlTablerowElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableRowElement
- class balderhub.html.lib.utils.components.HtmlTextareaElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- property value
- Returns:
returns the value attribute of this textarea element
- class balderhub.html.lib.utils.components.HtmlUlElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLUListElement
- class balderhub.html.lib.utils.components.AbstractHtmlInputElement(bridge: BaseWebdriverElementBridge)
Bases:
HtmlElement,ABCThis is an abstract class that is used by all more specific input elements in
balderhub.html.utils.components.input.``The element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement
- property value
- Returns:
returns the value attribute of this input element
Inputs
- class balderhub.html.lib.utils.components.inputs.HtmlButtonInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/button
- class balderhub.html.lib.utils.components.inputs.HtmlCheckboxInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TwoStateCheckboxMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox
- is_checked()
This method returns True if the element is checked, otherwise False :return: True if the element is checked, otherwise False
- class balderhub.html.lib.utils.components.inputs.HtmlColorInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color
- clear()
Clears html input element.
- class balderhub.html.lib.utils.components.inputs.HtmlDateInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date
- clear()
Clears html input element.
- class balderhub.html.lib.utils.components.inputs.HtmlDatetimelocalInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
- clear()
Clears html input element.
- class balderhub.html.lib.utils.components.inputs.HtmlEmailInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlFileInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file
- class balderhub.html.lib.utils.components.inputs.HtmlHiddenInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/hidden
- clear()
Clears html input element.
- class balderhub.html.lib.utils.components.inputs.HtmlImageInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/image
- class balderhub.html.lib.utils.components.inputs.HtmlMonthInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/month
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlNumberInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlPasswordInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/password
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlRadioInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio
- class balderhub.html.lib.utils.components.inputs.HtmlRangeInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range
- class balderhub.html.lib.utils.components.inputs.HtmlResetInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/reset
- class balderhub.html.lib.utils.components.inputs.HtmlSearchInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlSubmitInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/submit
- class balderhub.html.lib.utils.components.inputs.HtmlTextInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlTelInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlTimeInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time
- clear()
Clears html input element.
- class balderhub.html.lib.utils.components.inputs.HtmlUrlInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElement,TypeableMixinThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url
- clear()
Clears html input element.
- type_text(text: str, clean_before: bool = False)
This method types a text in this element.
- Parameters:
text – the text that should be inserted
clean_before – True if the system should make sure that all previous filled text is deleted before inserting any new text
- class balderhub.html.lib.utils.components.inputs.HtmlWeekInput(bridge: BaseWebdriverElementBridge)
Bases:
AbstractHtmlInputElementThe element is implemented like described here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/week
- clear()
Clears html input element.
Further Utilities
- class balderhub.html.lib.utils.Selector(by_type: By, identifier: str)
Bases:
BaseSelectorGeneral selector class for referencing HTML elements.
You can use this selector for all kinds of guicontrol features (as long as they are supported).
- class By(value)
Bases:
ByEnum to specify the type of the selector
- classmethod by_class(name: str)
Helper method that returns a selector instance that uses CLASS as reference type
- Parameters:
name – the reference name
- Returns:
the new selector instance
- classmethod by_css(name: str)
Helper method that returns a selector instance that uses CSS as reference type
- Parameters:
name – the reference name
- Returns:
the new selector instance
- classmethod by_id(name: str)
Helper method that returns a selector instance that uses ID as reference type
- Parameters:
name – the reference name
- Returns:
the new selector instance
- classmethod by_name(name: str)
Helper method that returns a selector instance that uses NAME as reference type
- Parameters:
name – the reference name
- Returns:
the new selector instance
- classmethod by_tag(name: str)
Helper method that returns a selector instance that uses TAG as reference type
- Parameters:
name – the reference name
- Returns:
the new selector instance
- classmethod by_xpath(name: str)
Helper method that returns a selector instance that uses XPATH as reference type
- Parameters:
name – the reference name
- Returns:
the new selector instance