Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
catch needless wait_for_load_state timeouterrors
Nick Sweeting1d3f7e5f4d14
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.pyindex f4a2e4ec4..4022f2534 100644--- a/browser_use/browser/session.py+++ b/browser_use/browser/session.py@@ -2131,9 +2131,12 @@ class BrowserSession(BaseModel):assert self.agent_current_page is not None, 'Agent current page is not set'page = await self.get_current_page()- await page.wait_for_load_state(- timeout=5000,- ) # page has already loaded by this point, this is extra for previous action animations/frame loads to settle+ try:+ await page.wait_for_load_state(+ timeout=5000,+ ) # page has already loaded by this point, this is extra for previous action animations/frame loads to settle+ except Exception as e:+ pass# 0. Attempt full-page screenshot (sometimes times out for huge pages)try: