ddp_utils.browser.contracts¶
import ddp_utils.browser.contracts
Stable enums and capability descriptors for browser backends.
- class ddp_utils.browser.contracts.BrowserTechnology(value)¶
Bases:
_NormalizedEnumAutomation technology used by a managed or attached session.
Examples
Select the Playwright adapter:
technology = BrowserTechnology.PLAYWRIGHT
- class ddp_utils.browser.contracts.BrowserProduct(value)¶
Bases:
_NormalizedEnumBrowser product requested by the project.
Examples
Request Firefox independently of the automation technology:
product = BrowserProduct.FIREFOX
- class ddp_utils.browser.contracts.IdentityMode(value)¶
Bases:
_NormalizedEnumIdentity policy applied to the concrete browser provider.
Examples
Request a coherent natural identity:
identity = IdentityMode.NATURAL
- class ddp_utils.browser.contracts.LaunchMode(value)¶
Bases:
_NormalizedEnumOwnership and connection mode for the browser process.
Examples
Attach to an explicitly prepared browser process:
mode = LaunchMode.ATTACH
- class ddp_utils.browser.contracts.BrowserCapability(value)¶
Bases:
_NormalizedEnumStable names for backend features queried by business logic.
Examples
Check the DOM automation capability before preparing a workflow:
capability = BrowserCapability.DOM
- class ddp_utils.browser.contracts.BackendDescriptor(name: str, technology: BrowserTechnology | None, product: BrowserProduct, provider: str, capabilities: frozenset[BrowserCapability] = <factory>, metadata: dict[str, ~typing.Any]=<factory>)¶
Bases:
objectDescribe one concrete backend and its immutable capabilities.
Parameters
Name
Type
Description
name
str
Stable concrete backend name.
technology
BrowserTechnology | None
Automation technology, or
Nonefor native process mode.product
Browser product represented by the backend.
provider
str
Concrete provider such as
seleniumbaseorcamoufox.capabilities
frozenset[BrowserCapability]
Supported facade capabilities.
metadata
dict[str, Any]
Additional immutable discovery or version information.
Examples
Describe a Camoufox session:
descriptor = BackendDescriptor( name="camoufox", technology=BrowserTechnology.PLAYWRIGHT, product=BrowserProduct.FIREFOX, provider="camoufox", capabilities=frozenset({BrowserCapability.DOM}), )
- supports(capability: BrowserCapability | str) bool¶
Return whether this backend supports a capability.
Parameters
Name
Type
Description
capability
BrowserCapability | str
Capability enum or normalized capability name.
Returns
Type
Description
bool
Truewhen the capability appears in this descriptor.Raises
Exception
Description
The capability name is unknown.
Examples
Check whether raw CDP commands are available:
if descriptor.supports("cdp"): browser.cdp.cmd("Network.enable")
- classmethod create(*, name: str, technology: BrowserTechnology | str | None, product: BrowserProduct | str, provider: str, capabilities: Iterable[BrowserCapability | str] = (), metadata: dict[str, Any] | None = None) BackendDescriptor¶
Create a normalized immutable backend descriptor.
Parameters
Name
Type
Description
name
str
Stable concrete backend name.
technology
BrowserTechnology | str | None
Automation technology, or
Nonefor native mode.product
BrowserProduct | str
Browser product represented by the backend.
provider
str
Concrete provider name.
capabilities
Iterable[BrowserCapability | str]
Supported capabilities.
metadata
dict[str, Any] | None
Optional version and discovery details.
Returns
Type
Description
Normalized backend descriptor.
Raises
Exception
Description
Any enum-like value is invalid.
Examples
Create a native process descriptor:
descriptor = BackendDescriptor.create( name="native-edge", technology=None, product="edge", provider="system", capabilities=("native_process",), )