ddp_utils.browser.backends.selenium.launcher

import ddp_utils.browser.backends.selenium.launcher

Lazy Selenium and SeleniumBase browser construction.

class ddp_utils.browser.backends.selenium.launcher.SeleniumBrowserLauncher(*, webdriver_module: Any | None = None, seleniumbase_constructor: Callable[[...], Any] | None = None)

Bases: object

Construct WebDriver sessions without import-time optional dependencies.

Parameters

Name

Type

Description

webdriver_module

Any | None

Optional injected selenium.webdriver module.

seleniumbase_constructor

Callable[..., Any] | None

Optional injected SeleniumBase Driver.

Examples

Use lazy imports in production:

launcher = SeleniumBrowserLauncher()

Store optional injectable constructors without opening a browser.

Parameters

Name

Type

Description

webdriver_module

Any | None

Optional injected selenium.webdriver module.

seleniumbase_constructor

Callable[..., Any] | None

Optional injected SeleniumBase Driver.

Examples

Inject fakes for deterministic unit tests:

launcher = SeleniumBrowserLauncher(webdriver_module=fake_webdriver)
launch(config: BrowserConfig, options: SeleniumLaunchOptions) → SeleniumNativeObjects

Launch the resolved Selenium provider.

Parameters

Name

Type

Description

config

BrowserConfig

Validated Selenium browser configuration.

options

SeleniumLaunchOptions

Normalized provider launch options.

Returns

Type

Description

SeleniumNativeObjects

Explicit native WebDriver and optional SeleniumBase objects.

Raises

Exception

Description

BrowserConfigurationError

The selected combination cannot be implemented without silently ignoring configuration.

BrowserStartupError

Dependencies are missing or startup fails.

Examples

Launch after backend validation:

native = launcher.launch(config, options)