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
force-start browser is is_connected is false when create_new_tab
Nick Sweeting67b9a267db73
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 296767129..ed80216fe 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -1430,10 +1430,10 @@ class Agent(Generic[Context]):try:self._log_agent_event(max_steps=max_steps, agent_run_error=agent_run_error)except Exception as log_e: # Catch potential errors during logging itself- logger.error(f'Failed to log telemetry event: {log_e}', exc_info=True)+ self.logger.error(f'Failed to log telemetry event: {log_e}', exc_info=True)else:# ADDED: Info message when custom telemetry for SIGINT was already logged- logger.info('Telemetry for force exit (SIGINT) was logged by custom exit callback.')+ self.logger.info('Telemetry for force exit (SIGINT) was logged by custom exit callback.')await self.close()diff --git a/browser_use/browser/session.py b/browser_use/browser/session.pyindex 5721eb860..acce0b32a 100644--- a/browser_use/browser/session.py+++ b/browser_use/browser/session.py@@ -2522,6 +2522,10 @@ class BrowserSession(BaseModel):if url and not self._is_url_allowed(url):raise BrowserError(f'Cannot create new tab with non-allowed URL: {url}')+ if not self.initialized or not self.is_connected():+ await self.start()+ assert self.browser_context, 'Browser context is not set'+new_page = await self.browser_context.new_page()# Update agent tab reference