mahler.protocols
Submodules
Classes
Remote browser object API. |
|
Remote browser interactive API. |
Package Contents
- class mahler.protocols.Element(native_element: Any, parent: Element | None = None)
Bases:
ProtocolRemote browser object API.
- Parameters:
native_element (Any) – The native element API for the underlying automation suite.
parent (Element | None, optional) – The parent. Defaults to None.
- query_selector_all(selector: str) list[Element] | None
Select all child elements of this node that match the given selector.
- Parameters:
selector (str) – A CSS or XPATH selector string.
- Returns:
- A list of elements found, if any.
Otherwise, None.
- Return type:
list[Element] | None
- query_selector(selector: str) Element | None
Select the first child element of this node that matches the given selector.
- Parameters:
selector (str) – A CSS or XPATH selector string.
- Returns:
Found element, if any. Otherwise, None.
- Return type:
list[Element] | None
- click() None
Click on this element.
- content() str
Return the text content of this element.
- type_on(text: str, delay: float = 0) None
Emulate typing on this element.
- Parameters:
text (str) – Text to type.
delay (float, optional) – Time in seconds to wait between keys. Defaults to 0.
- class mahler.protocols.Window(model: Literal['chrome', 'firefox'], headless: bool = True, enable_javascript: bool = True, fingerprint: mahler.fingerprint.Fingerprint | None = None)
Bases:
ProtocolRemote browser interactive API.
- Parameters:
model (Literal["chrome", "firefox"]) – Browser type.
headless (bool, optional) – Run in headless mode. Defaults to True.
enable_javascript (bool, optional) – Enable JavaScript in browser. Defaults to True.
fingerprint (Fingerprint | None, optional) – Browser fingerprint to apply, if any. Defaults to None.
- goto(url: str, timeout: float | None = None) None
Navigate to a URL.
- Parameters:
url (str) – URL to visit.
timeout (float | None, optional) – Time in seconds to let load. Defaults to None.
- query_selector_all(selector: str) list[mahler.protocols.element.Element] | None
Select all elements on the page that match the given selector.
- Parameters:
selector (str) – A CSS or XPATH selector string.
- Returns:
- A list of elements found, if any.
Otherwise, None.
- Return type:
list[Element] | None
- query_selector(selector: str) mahler.protocols.element.Element | None
Select the first element on the page that matches the given selector.
- Parameters:
selector (str) – A CSS or XPATH selector string.
- Returns:
Found element, if any. Otherwise, None.
- Return type:
list[Element] | None