ddp_utils.browser.backends.selenium.backend¶
import ddp_utils.browser.backends.selenium.backend
Concrete Selenium and SeleniumBase backend selection.
- class ddp_utils.browser.backends.selenium.backend.SeleniumBrowserBackend(product: BrowserProduct | str, *, provider: str, launcher: SeleniumBrowserLauncher | None = None)¶
Bases:
BrowserBackendCreate a standard Selenium or SeleniumBase managed session.
Parameters
Name
Type
Description
product
BrowserProduct | str
Browser product implemented by this backend instance.
provider
str
Concrete
seleniumorseleniumbaseprovider.launcher
SeleniumBrowserLauncher | None
Optional injected lifecycle launcher.
Examples
Create the natural Chrome provider selected by configuration:
backend = SeleniumBrowserBackend("chrome", provider="seleniumbase")
Initialize immutable identity without importing browser dependencies.
Parameters
Name
Type
Description
product
BrowserProduct | str
Browser product implemented by this backend instance.
provider
str
Concrete
seleniumorseleniumbaseprovider.launcher
SeleniumBrowserLauncher | None
Optional injected lifecycle launcher.
Raises
Exception
Description
The provider is unsupported.
Examples
Inject a fake launcher for a contract test:
backend = SeleniumBrowserBackend( "firefox", provider="selenium", launcher=fake_launcher )
- property descriptor: BackendDescriptor¶
Return immutable provider identity and potential capabilities.
Returns
Selenium backend descriptor.
Examples
Check CDP potential before startup:
assert backend.descriptor.supports("cdp")
- start(config: BrowserConfig) SeleniumBrowserSession¶
Validate, launch, and own one Selenium browser session.
Parameters
Name
Type
Description
config
Validated configuration targeting this backend.
Returns
Type
Description
Started Selenium session with exact lifecycle ownership.
Raises
Exception
Description
Technology, product, provider, or launch mode contradicts this backend.
Optional dependencies or browser startup fail.
Examples
Start the backend selected by
BackendRegistry:session = backend.start(config)