Skip to content

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

Merge branch 'main' into cursor/ignore-about-blank-tab-in-context-d397

Magnus Müllera9895087a8ac
diff --cc browser_use/browser/session.py
index 28d681307,5d9852c9f..101b2791c
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@@ -1833,17 -2140,10 +2140,19 @@@ class BrowserSession(BaseModel)
title = await self._get_page_title(page)
tab_info = TabInfo(page_id=page_id, url=page.url, title=title)
except Exception:
- # page.title() can hang forever on tabs that are crashed/disappeared/new tab pages
- # we dont want to try automating those tabs because they will hang the whole script
- self.logger.debug(f'⚠️ Failed to get tab info for tab #{page_id}: {_log_pretty_url(page.url)} (ignoring)')
- tab_info = TabInfo(page_id=page_id, url='about:blank', title='ignore this tab and do not use it')
++
+ # page.title() can hang forever on tabs that are crashed/disappeared/about:blank
+ # but we should preserve the real URL and not mislead the LLM about tab availability
+ self.logger.debug(f'⚠️ Failed to get tab info for tab #{page_id}: {_log_pretty_url(page.url)} (using fallback title)')
+
+ # Only mark as unusable if it's actually about:blank, otherwise preserve the real URL
+ if page.url == 'about:blank':
+ tab_info = TabInfo(page_id=page_id, url='about:blank', title='ignore this tab and do not use it')
+ else:
+ # Preserve the real URL and use a descriptive fallback title
+ fallback_title = f'(title unavailable)'
+ tab_info = TabInfo(page_id=page_id, url=page.url, title=fallback_title)
++
tabs_info.append(tab_info)
return tabs_info