Skip to content

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

fix: title fallback checks if focused tab was found, not if title is empty

ShawnPana4163531dfddc
diff --git a/browser_use/skill_cli/actions.py b/browser_use/skill_cli/actions.py
index 8a882dd80..f7f6fcd2c 100644
--- a/browser_use/skill_cli/actions.py
+++ b/browser_use/skill_cli/actions.py
@@ -177,11 +177,13 @@ class ActionHandler:
# Use focused tab's title, not tabs[0]
title = ''
focused_id = self.bs.agent_focus_target_id
+ found_focused = False
for tab in tabs:
if tab.target_id == focused_id:
title = tab.title
+ found_focused = True
break
- if not title and tabs:
+ if not found_focused and tabs:
title = tabs[0].title
return BrowserStateSummary(