This commit is contained in:
a2a-platform
2026-06-27 15:48:52 +00:00
parent 50ee33fefc
commit 7497ebd603
3 changed files with 24 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ import html
import json
import os
import re
import shutil
import subprocess
import sys
import time
@@ -118,7 +119,7 @@ class BrowserToApiAgent(A2AAgent[BrowserToApiConfig, NoAuth]):
"SeleniumBase-style browser agent that turns observed website traffic "
"into OpenAPI specs, coverage reports, samples, and a replay client."
)
version = "0.2.0"
version = "0.2.1"
config_model = BrowserToApiConfig
auth_model = NoAuth
@@ -338,6 +339,13 @@ def _launch_chromium(p: Any, log: list[str]) -> Any:
"--no-sandbox",
],
}
system_chromium = _system_chromium_path()
if system_chromium:
try:
log.append(f"browser: using system chromium at {system_chromium}")
return p.chromium.launch(executable_path=system_chromium, **launch_kwargs)
except Exception as exc: # noqa: BLE001
log.append(f"browser warning: system chromium failed: {type(exc).__name__}: {exc}")
try:
return p.chromium.launch(**launch_kwargs)
except Exception as exc: # noqa: BLE001
@@ -359,6 +367,17 @@ def _launch_chromium(p: Any, log: list[str]) -> Any:
return p.chromium.launch(**launch_kwargs)
def _system_chromium_path() -> str | None:
for candidate in ("chromium", "chromium-browser", "google-chrome", "google-chrome-stable"):
path = shutil.which(candidate)
if path:
return path
for path in ("/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/google-chrome"):
if Path(path).exists():
return path
return None
def _fill_search_inputs(page: Any, search_term: str | None, log: list[str]) -> None:
if not search_term:
return