ddp_utils.browser.factory

import ddp_utils.browser.factory

Single construction boundary for backend-neutral browser sessions.

class ddp_utils.browser.factory.BrowserFactory(registry: BackendRegistry | None = None)

Bases: object

Validate configuration, resolve a backend, and start one session.

Parameters

Name

Type

Description

registry

BackendRegistry | None

Explicit backend registry. Core defaults are used when omitted.

Examples

Start a native system browser from manifest-like values:

session = BrowserFactory().open(
    {"technology": "native", "browser": "chrome"}
)

Initialize the factory without importing optional technologies.

Parameters

Name

Type

Description

registry

BackendRegistry | None

Explicit backend registry. Core defaults are used when omitted.

Examples

Supply a controlled registry in tests or embedded runtimes:

factory = BrowserFactory(registry=test_registry)
property registry: BackendRegistry

Return the provider registry used by this factory.

Returns

Mutable explicit backend registry.

Examples

Register an optional backend before opening a session:

factory.registry.register("playwright", builder)
open(config: BrowserConfig | Mapping[str, Any], **overrides: Any) → Browser

Start one browser session from configuration and runtime overrides.

Parameters

Name

Type

Description

config

BrowserConfig | Mapping[str, Any]

Validated config or manifest-like mapping.

**overrides

Any

Explicit per-launch BrowserConfig field overrides.

Returns

Type

Description

Browser

Started browser facade owning the neutral session.

Raises

Exception

Description

BrowserConfigurationError

Configuration is invalid.

BrowserStartupError

Provider resolution or startup fails.

Examples

Override headless mode for one managed launch:

session = factory.open(config, headless=True)