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
Increase screenshot event timeout to 15 seconds and adjust sleep duration in screenshot watchdog
Magnus Müllerb113e381a224
diff --git a/browser_use/browser/dom_watchdog.py b/browser_use/browser/dom_watchdog.pyindex 221e814e2..38eed3d34 100644--- a/browser_use/browser/dom_watchdog.py+++ b/browser_use/browser/dom_watchdog.py@@ -261,7 +261,7 @@ class DOMWatchdog(BaseWatchdog):handler_names = [getattr(h, '__name__', str(h)) for h in handlers]self.logger.debug(f'📸 ScreenshotEvent handlers registered: {len(handlers)} - {handler_names}')- screenshot_event = self.event_bus.dispatch(ScreenshotEvent(full_page=False, event_timeout=6.0))+ screenshot_event = self.event_bus.dispatch(ScreenshotEvent(full_page=False, event_timeout=15.0))self.logger.debug('📸 Dispatched ScreenshotEvent, waiting for event to complete...')# Get the screenshot base64 string directly from event_result()@@ -272,7 +272,7 @@ class DOMWatchdog(BaseWatchdog):screenshot_b64 = Noneself.logger.warning('📸 Screenshot handler returned None')except TimeoutError:- self.logger.warning('📸 Screenshot timed out after 6 seconds - no handler registered or slow page?')+ self.logger.warning('📸 Screenshot timed out after 15 seconds - no handler registered or slow page?')except Exception as e:self.logger.warning(f'📸 Screenshot failed: {type(e).__name__}: {e}')else:diff --git a/browser_use/browser/screenshot_watchdog.py b/browser_use/browser/screenshot_watchdog.pyindex 5dbe2f598..d2598fe09 100644--- a/browser_use/browser/screenshot_watchdog.py+++ b/browser_use/browser/screenshot_watchdog.py@@ -49,7 +49,7 @@ class ScreenshotWatchdog(BaseWatchdog):# Small delay to ensure the tab switch is completeimport asyncio- await asyncio.sleep(0.2)+ await asyncio.sleep(0.1)# Prepare screenshot parametersparams = CaptureScreenshotParameters(format='png', captureBeyondViewport=False)