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
immediately update focus on SwitchTab to fix laminar issue
Nick Sweetingd84f89abf918
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.pyindex 0bcdb8f06..0a82631a3 100644--- a/browser_use/browser/session.py+++ b/browser_use/browser/session.py@@ -524,7 +524,7 @@ class BrowserSession(BaseModel):target_id = targets[event.tab_index]['targetId']# Activate target- await self.cdp_client.send.Target.activateTarget(params={'targetId': target_id})+ self.agent_focus = await self.get_or_create_cdp_session(target_id=target_id, focus=True)# Dispatch focus changed eventtarget_url = targets[event.tab_index].get('url', '')