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
ruff fixes
Nick Sweeting36770697c121
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 2d5b3610b..612c98dc1 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -559,15 +559,15 @@ class Agent(Generic[Context]):self.state.consecutive_failures += 1else:+ from anthropic import RateLimitError as AnthropicRateLimitErrorfrom google.api_core.exceptions import ResourceExhaustedfrom openai import RateLimitError- from anthropic import RateLimitError as AnthropicRateLimitError# Define a tuple of rate limit error types for easier maintenanceRATE_LIMIT_ERRORS = (- RateLimitError, # OpenAI- ResourceExhausted, # Google- AnthropicRateLimitError, # Anthropic+ RateLimitError, # OpenAI+ ResourceExhausted, # Google+ AnthropicRateLimitError, # Anthropic)if isinstance(error, RATE_LIMIT_ERRORS):diff --git a/browser_use/browser/context.py b/browser_use/browser/context.pyindex 1854bae78..cb9f3f56e 100644--- a/browser_use/browser/context.py+++ b/browser_use/browser/context.py@@ -1456,7 +1456,7 @@ class BrowserContext:if self.active_tab and self.active_tab in session.context.pages and not self.active_tab.is_closed():return self.active_tab-+# 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://') and not page.url.startswith('chrome://')