bridges: let the browser bridge use an installed browser

Add `bridges.browser.channel` and `bridges.browser.executable_path` so a host
can point the bridge at an already-installed Chrome/Chromium (a Playwright
channel such as `chrome`/`msedge`, or a specific binary) instead of Playwright's
managed build. `executable_path` wins when both are set. This is the no-download
escape hatch for hosts where the browser CDN is unreachable or unusable.

- `BrowserDriver` carries `channel`/`executable_path` and passes them to
  `launch_persistent_context` when set, so the managed download is skipped.
- `BrowserBridge` reads both from its config block; `config.example.json`
  documents them.
- Verified live: launching an installed Chromium via `executable_path` with an
  empty browsers path drives a real page with no managed download.
This commit is contained in:
gabby committed 2026-10-11 09:46:44 +00:00
1 parent e4961ef492
commit 3a5b90b1cb
6 files changed
+54 -7

No files matched your search

+7
View File
@@ -132,6 +132,11 @@ class BrowserBridge(BridgeService):
self.screenshot_dir = str(cfg.get("screenshot_dir") or DEFAULT_SCREENSHOT_DIR)
self.default_timeout = float(cfg.get("default_timeout", DEFAULT_TIMEOUT))
self.max_text_chars = int(cfg.get("max_text_chars", DEFAULT_MAX_TEXT_CHARS))
#: Optional escape hatch: use an installed browser instead of Playwright's
#: managed download. `channel` is a Playwright channel (chrome/msedge/...),
#: `executable_path` a specific binary; `executable_path` wins if both set.
self.channel = str(cfg.get("channel", "") or "").strip()
self.executable_path = str(cfg.get("executable_path", "") or "").strip()
#: A test seam: inject a driver double. Production builds the real one.
self.client = client or BrowserDriver(
engine=self.engine,
@@ -141,6 +146,8 @@ class BrowserBridge(BridgeService):
screenshot_dir=self.screenshot_dir,
default_timeout=self.default_timeout,
max_text_chars=self.max_text_chars,
channel=self.channel,
executable_path=self.executable_path,
)
# ---- lifecycle ----