Skip to content

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

fix keep_alive logic

Nick Sweeting6c74b09e22e9
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index b9f0870fa..c2f6c8b0a 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -636,7 +636,7 @@ class BrowserSession(BaseModel):
def _set_browser_keep_alive(self, keep_alive: bool | None) -> None:
"""set the keep_alive flag on the browser_profile, defaulting to True if keep_alive is None"""
- if keep_alive is None:
+ if self.browser_profile.keep_alive is None:
self.browser_profile.keep_alive = keep_alive
# --- Tab management ---