Skip to content

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

tweak launch detection

Nick Sweetingd9b20d873a92
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index c319ee53c..833946df5 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -1073,8 +1073,8 @@ class BrowserSession(BaseModel):
# It will wait for the CDP port to become available
await self.setup_browser_via_browser_pid()
- # If connection failed, browser_context will be None
- if not self.browser_context:
+ # If connection failed, browser will be None
+ if not self.browser:
# Try to get error info from the process
if process.returncode is not None:
raise RuntimeError(f'Chrome subprocess exited with code {process.returncode}')