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

+18
View File
@@ -309,6 +309,24 @@ def test_bad_engine_falls_back_to_chromium():
assert BrowserBridge({"engine": "WebKit"}).engine == "webkit"
def test_executable_path_and_channel_are_plumbed():
bridge = BrowserBridge(
{"channel": "chrome", "executable_path": "/usr/bin/google-chrome"}
)
assert bridge.channel == "chrome"
assert bridge.executable_path == "/usr/bin/google-chrome"
# The real driver (no injected double) carries them; executable_path wins at
# launch, so the managed download is skipped entirely.
assert bridge.client.channel == "chrome"
assert bridge.client.executable_path == "/usr/bin/google-chrome"
def test_driver_defaults_to_managed_browser():
driver = BrowserDriver()
assert driver.channel == ""
assert driver.executable_path == ""
# ---- driver dependency handling ----
def test_driver_unavailable_without_playwright(monkeypatch):