ddp_utils.browser.backends.native.backend

import ddp_utils.browser.backends.native.backend

Native browser backend implementation.

class ddp_utils.browser.backends.native.backend.NativeBrowserBackend(product: BrowserProduct | str, *, discovery: NativeBrowserDiscovery | None = None, launcher: NativeBrowserLauncher | None = None, controller: NativeProcessController | None = None)

Bases: BrowserBackend

Launch and own one system browser without DOM automation claims.

Parameters

Name

Type

Description

product

BrowserProduct | str

Browser product implemented by this backend instance.

discovery

NativeBrowserDiscovery | None

Executable discovery service.

launcher

NativeBrowserLauncher | None

Process launcher service.

controller

NativeProcessController | None

Process-tree lifecycle service.

Examples

Create the native Edge backend:

backend = NativeBrowserBackend("edge")

Initialize backend services without launching a process.

Parameters

Name

Type

Description

product

BrowserProduct | str

Browser product implemented by this backend instance.

discovery

NativeBrowserDiscovery | None

Optional executable discovery service.

launcher

NativeBrowserLauncher | None

Optional process launcher service.

controller

NativeProcessController | None

Optional process-tree lifecycle service.

Examples

Inject fake services for deterministic contract tests:

backend = NativeBrowserBackend("chrome", discovery=fake_discovery)
property descriptor: BackendDescriptor

Return the immutable native backend descriptor.

Returns

Descriptor advertising only native process ownership.

Examples

Inspect the backend before launch:

assert backend.descriptor.provider == "system"
start(config: BrowserConfig) → NativeBrowserSession

Discover, launch, and own a native browser process.

Parameters

Name

Type

Description

config

BrowserConfig

Validated native configuration for this browser product.

Returns

Type

Description

NativeBrowserSession

Started native browser session.

Raises

Exception

Description

BrowserConfigurationError

Configuration targets another mode or product.

BrowserStartupError

Discovery or operating-system launch fails.

Examples

Launch a system Chrome window under exact process ownership:

session = NativeBrowserBackend("chrome").start(config)