From 2e5ab70aeecbf8ecbb4198f2f05e5ca9c1d1ffc3 Mon Sep 17 00:00:00 2001 From: aditya-silna Date: Fri, 4 Jul 2025 14:41:06 -0400 Subject: [PATCH 1/2] add headers to cdp connect --- stagehand/browser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stagehand/browser.py b/stagehand/browser.py index 832900ca..047adf14 100644 --- a/stagehand/browser.py +++ b/stagehand/browser.py @@ -129,7 +129,10 @@ async def connect_local_browser( if cdp_url: logger.info(f"Connecting to local browser via CDP URL: {cdp_url}") try: - browser = await playwright.chromium.connect_over_cdp(cdp_url) + browser = await playwright.chromium.connect_over_cdp( + cdp_url, + headers=local_browser_launch_options.get("headers") + ) if not browser.contexts: raise RuntimeError(f"No browser contexts found at CDP URL: {cdp_url}") From 76802662d9d4997278913541103cec1ad6501e5c Mon Sep 17 00:00:00 2001 From: aditya-silna Date: Sun, 6 Jul 2025 15:07:51 -0400 Subject: [PATCH 2/2] fix --- stagehand/browser.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stagehand/browser.py b/stagehand/browser.py index 047adf14..27278ed6 100644 --- a/stagehand/browser.py +++ b/stagehand/browser.py @@ -130,8 +130,7 @@ async def connect_local_browser( logger.info(f"Connecting to local browser via CDP URL: {cdp_url}") try: browser = await playwright.chromium.connect_over_cdp( - cdp_url, - headers=local_browser_launch_options.get("headers") + cdp_url, headers=local_browser_launch_options.get("headers") ) if not browser.contexts: