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
Attach watchdog only when record_har_path is provided
kalil03216dbdaab6b163
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.pyindex 8ed64aabb..f4f22a04f 100644--- a/browser_use/browser/session.py+++ b/browser_use/browser/session.py@@ -1515,10 +1515,11 @@ class BrowserSession(BaseModel):self._recording_watchdog = RecordingWatchdog(event_bus=self.event_bus, browser_session=self)self._recording_watchdog.attach_to_session()- # Initialize HarRecordingWatchdog (handles HTTPS HAR capture)- HarRecordingWatchdog.model_rebuild()- self._har_recording_watchdog = HarRecordingWatchdog(event_bus=self.event_bus, browser_session=self)- self._har_recording_watchdog.attach_to_session()+ # Initialize HarRecordingWatchdog if record_har_path is configured (handles HTTPS HAR capture)+ if self.browser_profile.record_har_path:+ HarRecordingWatchdog.model_rebuild()+ self._har_recording_watchdog = HarRecordingWatchdog(event_bus=self.event_bus, browser_session=self)+ self._har_recording_watchdog.attach_to_session()# Mark watchdogs as attached to prevent duplicate attachmentself._watchdogs_attached = True