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
fix cdp calls
Nick Sweeting1e93507fe375
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.pyindex 4946f46e0..2145fbaa9 100644--- a/browser_use/browser/session.py+++ b/browser_use/browser/session.py@@ -2730,11 +2730,7 @@ class BrowserSession(BaseModel):# Take the screenshot using CDP# https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot# Use the internal channel.send method to bypass some of the async wrapper issues- from playwright._impl._helper import locals_to_params-- result = await cdp_session._impl_obj._channel.send(- 'send', locals_to_params({'method': 'Page.captureScreenshot', 'params': cdp_params})- )+ result = await cdp_session._impl_obj._channel.send('send', {'method': 'Page.captureScreenshot', 'params': cdp_params})# The result already contains base64 encoded database64_screenshot = result.get('data')@@ -2755,9 +2751,7 @@ class BrowserSession(BaseModel):if cdp_session:try:# Use internal method to ensure proper cleanup- from playwright._impl._helper import locals_to_params-- await cdp_session._impl_obj._channel.send('detach', locals_to_params({}))+ await cdp_session._impl_obj._channel.send('detach', {})except Exception:# Ignore all exceptions during cleanuppass