Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
use the BROWSER_REMOTE_DEBUGGING_URL for cdp connect directly (#2040)
Shuchang Zhengd54c2af544e4
diff --git a/skyvern/webeye/browser_factory.py b/skyvern/webeye/browser_factory.pyindex 66db458d3..86f886e77 100644--- a/skyvern/webeye/browser_factory.py+++ b/skyvern/webeye/browser_factory.py@@ -9,7 +9,6 @@ from pathlib import Pathfrom typing import Any, Awaitable, Callable, Protocolimport aiofiles-import httpximport structlogfrom playwright.async_api import BrowserContext, ConsoleMessage, Download, Page, Playwrightfrom pydantic import BaseModel, PrivateAttr@@ -359,21 +358,7 @@ async def _create_cdp_connection_browser(har_path=browser_args["record_har_path"],)- remote_browser_url = None- try:- async with httpx.AsyncClient() as client:- response = await client.get(f"{settings.BROWSER_REMOTE_DEBUGGING_URL}/json/version")- remote_browser_url = response.json().get("webSocketDebuggerUrl")- except Exception:- raise Exception(- f"Cannot find the webSocketDebuggerUrl from the browser remote debugging {settings.BROWSER_REMOTE_DEBUGGING_URL}"- )-- if not remote_browser_url:- raise Exception(- f"Cannot find the webSocketDebuggerUrl from the browser remote debugging {settings.BROWSER_REMOTE_DEBUGGING_URL}"- )-+ remote_browser_url = settings.BROWSER_REMOTE_DEBUGGING_URLLOG.info("Connecting browser CDP connection", remote_browser_url=remote_browser_url)browser = await playwright.chromium.connect_over_cdp(remote_browser_url)