Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

raise timeout for interactivity check to avoid flaky tests

Nick Sweeting4959b9b4afd3
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 93581147a..6ab314930 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -2985,13 +2985,13 @@ class BrowserSession(BaseModel):
async def _get_updated_state(self, focus_element: int = -1) -> BrowserStateSummary:
"""Update and return state."""
+ # Check if current page is still valid, if not switch to another available page
page = await self.get_current_page()
- # Check if current page is still valid, if not switch to another available page
try:
# Test if page is still accessible
# NOTE: This also happens on invalid urls like www.sadfdsafdssdafd.com
- await asyncio.wait_for(page.evaluate('1'), timeout=1.0)
+ await asyncio.wait_for(page.evaluate('1'), timeout=2.5)
except Exception as e:
self.logger.debug(f'👋 Current page is not accessible: {type(e).__name__}: {e}')
raise BrowserError('Page is not accessible')