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 #1405: HAR file is not saved
kalil0321f4985879c36f
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.pyindex 06c4bfa45..13ac2a68e 100644--- a/browser_use/browser/context.py+++ b/browser_use/browser/context.py@@ -185,7 +185,8 @@ class BrowserContextConfig(BaseModel):permissions: list[str] | None = Nonetimezone_id: str | None = None-+ force_new_context: bool = False+@dataclassclass CachedStateClickableElementsHashes:"""@@ -436,9 +437,9 @@ class BrowserContext:async def _create_context(self, browser: PlaywrightBrowser):"""Creates a new browser context with anti-detection measures and loads cookies if available."""- if self.browser.config.cdp_url and len(browser.contexts) > 0:+ if self.browser.config.cdp_url and len(browser.contexts) > 0 and not self.config.force_new_context:context = browser.contexts[0]- elif self.browser.config.browser_binary_path and len(browser.contexts) > 0:+ elif self.browser.config.browser_binary_path and len(browser.contexts) > 0 and not self.config.force_new_context:# Connect to existing Chrome instance instead of creating new onecontext = browser.contexts[0]else: