diff --git a/crawl4ai/browser_manager.py b/crawl4ai/browser_manager.py index d7b8009c8..98c8ae5ac 100644 --- a/crawl4ai/browser_manager.py +++ b/crawl4ai/browser_manager.py @@ -159,6 +159,19 @@ def __init__( cdp_url (str or None): CDP URL to connect to the browser. Default: None. browser_config (BrowserConfig): Configuration object containing all browser settings. Default: None. """ + if browser_config is None: + # The legacy keyword arguments above are still part of this + # signature and are documented in the docstring; honour them + # instead of raising an opaque AttributeError on ``None``. + browser_config = BrowserConfig( + browser_type=browser_type, + user_data_dir=user_data_dir, + headless=headless, + host=host, + debugging_port=debugging_port, + cdp_url=cdp_url, + ) + self.browser_type = browser_config.browser_type self.user_data_dir = browser_config.user_data_dir self.headless = browser_config.headless diff --git a/crawl4ai/browser_profiler.py b/crawl4ai/browser_profiler.py index c944a596c..6f38768b1 100644 --- a/crawl4ai/browser_profiler.py +++ b/crawl4ai/browser_profiler.py @@ -1202,12 +1202,15 @@ async def launch_builtin_browser(self, os.makedirs(user_data_dir, exist_ok=True) # Create managed browser instance - managed_browser = ManagedBrowser( + browser_config = BrowserConfig( browser_type=browser_type, user_data_dir=user_data_dir, headless=headless, + debugging_port=debugging_port, + ) + managed_browser = ManagedBrowser( + browser_config=browser_config, logger=self.logger, - debugging_port=debugging_port ) try: