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 for current page detection grabbing a chrome extension service worker
Nick Sweeting16879e4833df
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.pyindex bf7b43148..3a9f99d9a 100644--- a/browser_use/browser/context.py+++ b/browser_use/browser/context.py@@ -1313,8 +1313,13 @@ class BrowserContext:if page.url == target['url']:return page- # Fallback to last page- return pages[-1] if pages else await session.context.new_page()+ # fall back to most recently opened non-extension page (extensions are almost always invisible background targets)+ non_extension_pages = [page for page in pages if not page.url.startswith('chrome-extension://')]+ if non_extension_pages:+ return non_extension_pages[-1]++ # Fallback to opening a new tab+ return await session.context.new_page()async def get_selector_map(self) -> SelectorMap:session = await self.get_session()