Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix recreate workflow browser (#673)
LawyZheng845ae8d3e405
diff --git a/skyvern/webeye/browser_factory.py b/skyvern/webeye/browser_factory.pyindex 3c6eb7f53..6d4c98720 100644--- a/skyvern/webeye/browser_factory.py+++ b/skyvern/webeye/browser_factory.py@@ -200,6 +200,7 @@ class BrowserState:url: str | None = None,proxy_location: ProxyLocation | None = None,task_id: str | None = None,+ workflow_run_id: str | None = None,) -> None:if self.pw is None:LOG.info("Starting playwright")@@ -216,6 +217,7 @@ class BrowserState:url=url,proxy_location=proxy_location,task_id=task_id,+ workflow_run_id=workflow_run_id,)self.browser_context = browser_contextself.browser_artifacts = browser_artifacts@@ -276,23 +278,30 @@ class BrowserState:url: str | None = None,proxy_location: ProxyLocation | None = None,task_id: str | None = None,+ workflow_run_id: str | None = None,) -> Page:if self.page is not None:return self.pagetry:- await self.check_and_fix_state(url=url, proxy_location=proxy_location, task_id=task_id)+ await self.check_and_fix_state(+ url=url, proxy_location=proxy_location, task_id=task_id, workflow_run_id=workflow_run_id+ )except Exception as e:error_message = str(e)if "net::ERR" not in error_message:raise eawait self.close_current_open_page()- await self.check_and_fix_state(url=url, proxy_location=proxy_location, task_id=task_id)+ await self.check_and_fix_state(+ url=url, proxy_location=proxy_location, task_id=task_id, workflow_run_id=workflow_run_id+ )assert self.page is not Noneif not await BrowserContextFactory.validate_browser_context(self.page):await self.close_current_open_page()- await self.check_and_fix_state(url=url, proxy_location=proxy_location, task_id=task_id)+ await self.check_and_fix_state(+ url=url, proxy_location=proxy_location, task_id=task_id, workflow_run_id=workflow_run_id+ )assert self.page is not Nonereturn self.pagediff --git a/skyvern/webeye/browser_manager.py b/skyvern/webeye/browser_manager.pyindex 446c8f547..e007fd781 100644--- a/skyvern/webeye/browser_manager.py+++ b/skyvern/webeye/browser_manager.py@@ -84,7 +84,9 @@ class BrowserManager:# The URL here is only used when creating a new page, and not when using an existing page.# This will make sure browser_state.page is not None.- await browser_state.get_or_create_page(url=url, proxy_location=workflow_run.proxy_location)+ await browser_state.get_or_create_page(+ url=url, proxy_location=workflow_run.proxy_location, workflow_run_id=workflow_run.workflow_run_id+ )self.pages[workflow_run.workflow_run_id] = browser_statereturn browser_state