Skip to content

API Reference parrot_tools.scraping.driver_factory

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.scraping.driver_factory

View source

Factory for creating browser automation driver instances.

Provides :class:DriverFactory as the single entry point for obtaining a properly configured :class:AbstractDriver. Consumers call DriverFactory.create(config) instead of instantiating driver classes directly.

Both PlaywrightDriver and SeleniumDriver are imported lazily so the module works even when only one library is installed.

Alias AbstractDriver

Re-exported from parrot_tools.scraping.drivers.abstract.AbstractDriver.

Class DriverFactory

Factory for creating browser automation driver instances.

Dispatches to the correct driver implementation based on configuration. This is the single entry point for obtaining an AbstractDriver.

Usage::

driver = DriverFactory.create({"driver_type": "playwright", "browser": "chromium"})
await driver.start()

Method DriverFactory.create

Create and return an AbstractDriver based on configuration.

create(config: Optional[Union[Dict[str, Any], Any]] = None) -> AbstractDriver

Parameter Type Default Description
config Optional[Union[Dict[str, Any], Any]] None Driver configuration. Can be a dict, a Pydantic model (with model_dump()), or a dataclass. If None, defaults to PlaywrightDriver with Chrome. Key fields: - driver_type: "selenium", "playwright", or "obscura" (default: "playwright"). "obscura" returns a PlaywrightDriver connected over CDP to a supervised Obscura process (see parrot.mcp.obscura.ObscuraProcessManager) — it does not launch a browser itself. - browser: Browser name (default: "chrome"). Ignored for driver_type="obscura", which always connects over Chromium CDP (Obscura speaks CDP as a Chromium-compatible engine). - headless: Whether to run headless (default: True) - browser_binary: Browser executable to launch; for Chrome-family browsers it defaults to the DEFAULT_CHROME_EXECUTABLE_PATH setting. - cdp_endpoint_url, obscura_binary, obscura_port, obscura_stealth, obscura_allow_private_network: forwarded to PlaywrightConfig when driver_type="obscura". - Plus driver-specific options.

Returns: AbstractDriver — An AbstractDriver instance (not yet started — caller must await driver.start()).

Raises:

  • ValueError — If driver_type is unknown or browser name is invalid for Playwright.

Attribute logger

Alias resolve_browser_binary

Re-exported from parrot_tools.scraping.toolkit_models.resolve_browser_binary.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally