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 lint
kalil03211c85a8a6886d
diff --git a/browser_use/browser/demo_mode.py b/browser_use/browser/demo_mode.pyindex 81640e269..3eb4eb2f5 100644--- a/browser_use/browser/demo_mode.py+++ b/browser_use/browser/demo_mode.py@@ -853,7 +853,7 @@ class DemoMode:self.logger.warning(f'Failed to ensure demo mode is ready: {exc}')return- if self.session.agent_focus is None:+ if self.session.agent_focus_target_id is None:self.logger.debug('Cannot send demo log: no active target')return@@ -905,8 +905,8 @@ class DemoMode:)target_ids = [t['targetId'] for t in targets]- if not target_ids and self.session.agent_focus:- target_ids = [self.session.agent_focus.target_id]+ if not target_ids and self.session.agent_focus_target_id:+ target_ids = [self.session.agent_focus_target_id]for target_id in target_ids:try:diff --git a/browser_use/dom/service.py b/browser_use/dom/service.pyindex b95dbeac2..d472400d4 100644--- a/browser_use/dom/service.py+++ b/browser_use/dom/service.py@@ -769,7 +769,7 @@ class DomService:# Use current target (None means use current)assert self.browser_session.agent_focus_target_id is not None- session_id = self.browser_session.id+ session_id = self.browser_session.id# Build DOM tree (includes CDP calls for snapshot, DOM, AX tree)# Note: all_frames is fetched lazily inside get_dom_tree only if cross-origin iframes need it