Skip to content

Commit

Permalink
Navigate to new url when reusing browser sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
satansdeer committed Dec 17, 2024
1 parent 7364311 commit 164bb41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions skyvern/webeye/browser_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ async def check_and_fix_state(
if url:
await self.navigate_to_url(page=page, url=url)

async def update_attributes(self, **kwargs):
pass

async def navigate_to_url(self, page: Page, url: str, retry_times: int = NAVIGATION_MAX_RETRY_TIME) -> None:
navigation_error: Exception = FailedToNavigateToUrl(url=url, error_message="")
for retry_time in range(retry_times):
Expand Down
6 changes: 6 additions & 0 deletions skyvern/webeye/browser_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ async def get_or_create_for_workflow_run(self, workflow_run: WorkflowRun, url: s
browser_state = app.PERSISTENT_SESSIONS_MANAGER.get_session(context.organization_id, context.browser_session_id)
if browser_state is None:
LOG.warning("Browser state not found in persistent sessions manager", browser_session_id=context.browser_session_id)
else:
page = await browser_state.get_working_page()
if page:
await browser_state.navigate_to_url(page=page, url=url)
else:
LOG.warning("Browser state has no page", workflow_run_id=workflow_run.workflow_run_id)

if browser_state is None:
LOG.info(
Expand Down

0 comments on commit 164bb41

Please sign in to comment.