Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

not allow CDP for firefox

Edison Sd5534fb27559
diff --git a/browser_use/browser/browser.py b/browser_use/browser/browser.py
index 7cb6bd75d..6505bd39c 100644
--- a/browser_use/browser/browser.py
+++ b/browser_use/browser/browser.py
@@ -112,12 +112,17 @@ class Browser:
return self.playwright_browser
async def _setup_cdp(self, playwright: Playwright) -> PlaywrightBrowser:
- """Sets up and returns a Playwright Browser instance with anti-detection measures."""
- if not self.config.cdp_url:
- raise ValueError('CDP URL is required')
- logger.info(f'Connecting to remote browser via CDP {self.config.cdp_url}')
- browser_class = getattr(playwright, self.config.browser_class)
- browser = await browser_class.connect_over_cdp(self.config.cdp_url)
+ """Sets up and returns a Playwright Browser instance with anti-detection measures. Firefox has no longer CDP support."""
+ if 'firefox' not in self.config.browser_instance_path.lower():
+ if not self.config.cdp_url:
+ raise ValueError('CDP URL is required')
+ logger.info(f'Connecting to remote browser via CDP {self.config.cdp_url}')
+ browser_class = getattr(playwright, self.config.browser_class)
+ browser = await browser_class.connect_over_cdp(self.config.cdp_url)
+ else:
+ raise ValueError(
+ 'CDP has been deprecated for firefox, check: https://fxdx.dev/deprecating-cdp-support-in-firefox-embracing-the-future-with-webdriver-bidi/'
+ )
return browser
async def _setup_wss(self, playwright: Playwright) -> PlaywrightBrowser: