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
prevent pages from pausing execution and blocking agent using debugger breakpoints
Nick Sweetingd150b5ca09d7
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.pyindex fe79c672c..d72b60967 100644--- a/browser_use/browser/session.py+++ b/browser_use/browser/session.py@@ -120,7 +120,7 @@ class CDPSession(BaseModel):self.session_id = result['sessionId']# Use specified domains or default domains- domains = domains or ['Page', 'DOM', 'DOMSnapshot', 'Accessibility', 'Runtime', 'Inspector']+ domains = domains or ['Page', 'DOM', 'DOMSnapshot', 'Accessibility', 'Runtime', 'Inspector', 'Debugger']# Enable all domains in parallelenable_tasks = []@@ -137,6 +137,18 @@ class CDPSession(BaseModel):results = await asyncio.gather(*enable_tasks, return_exceptions=True)if any(isinstance(result, Exception) for result in results):raise RuntimeError(f'Failed to enable requested CDP domain: {results}')++ # disable breakpoints on the page so it doesnt pause on crashes / debugger statements+ try:+ await self.cdp_client.send.Debugger.setSkipAllPauses(params={'skip': True}, session_id=self.session_id)+ if 'Debugger' not in domains:+ await self.cdp_client.send.Debugger.disable()+ # await cdp_session.cdp_client.send.EventBreakpoints.disable(session_id=cdp_session.session_id)+ except Exception as e:+ # self.logger.warning(f'Failed to disable page JS breakpoints: {e}')+ pass++target_info = await self.get_target_info()self.title = target_info['title']self.url = target_info['url']