Browser
Configuration
- logikal_browser.config.BROWSER_VERSIONS
- The available browser versions as specified in the - tool.browser.versionssection in- pyproject.toml.
Base Classes
- class logikal_browser.BrowserVersion(version: str | None = None, install: bool = True, install_path: Path | None = None)
- Base class for browser versions. - Parameters:
- version – The browser version to use. Defaults to the appropriate version specified in - BROWSER_VERSIONS.
- install – Whether to install the web browser and the web driver. 
- install_path – The path to use for the installation. Defaults to - $XDG_CACHE_HOME/logikal_browser.
 
 
- class logikal_browser.Browser(*, settings: Settings, version: BrowserVersion | None = None, headless: bool = True, screenshot_path: Path = PosixPath('screenshot'), screenshot_tmp_path: Path | None = None, **kwargs: Any)
- 
Base class for browser-specific web drivers. - Parameters:
- settings – The browser settings to use. 
- version – The browser version to use. 
- headless – Whether to run in headless mode. 
- screenshot_path – The path where screenshots are stored. 
- screenshot_tmp_path – The temporary path to use for screenshots. 
 
 - check(name: str | None = None, wait_milliseconds: int | None = 100) None
- Create a screenshot and check it against an expected version. - Parameters:
- name – The name of the check. 
- wait_milliseconds – The milliseconds to wait before calculating the screenshot height for unlimited height checks. 
 
 
 - replace_text(element: Any, text: str) None
- Replace the text of an element. - Parameters:
- element – The element to use. 
- text – The new text value. 
 
 
 - wait_for_element(by: str, value: str, timeout_seconds: int = 10, poll_frequency: float = 0.5) None
- Wait until a given element is present. - Parameters:
- by – The selector type to use for locating the element. 
- value – The selector value to use for locating the element. 
- timeout_seconds – The maximal time to wait. 
- poll_frequency – Sleep interval between checks. 
 
 
 
Implementations
- class logikal_browser.chromium.ChromiumBrowser(*, settings: Settings, version: BrowserVersion | None = None, headless: bool = True, screenshot_path: Path = PosixPath('screenshot'), screenshot_tmp_path: Path | None = None, **kwargs: Any)
- Bases: - Browser- Abstract base class for Chromium-based WebDriver classes. 
Installation
- class logikal_browser.install.InstalledBrowser(browser_name: str, version: str, install: bool)
- Information related to an installed browser. - Parameters:
- browser_name – The name of the browser to install. 
- version – The browser version to install. 
- install – Whether to install the browser if necessary. 
 
 - browser_version: BrowserVersion
- The installed browser-specific - BrowserVersionsub-class instance.
 
- logikal_browser.install.installed_browsers(versions: dict[str, str] | None = None, install: bool = True) dict[str, InstalledBrowser]
- Return a mapping of versions to installed browsers. - Parameters:
- versions – A mapping of browser names to versions to install. Defaults to - BROWSER_VERSIONS.
- install – Whether to install the browsers if necessary.