Skip to content

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

Run ruff fix and format on modified files

Dha-aa7ca46f22c273
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.py
index 7c270d811..0b6a2da53 100644
--- a/browser_use/agent/views.py
+++ b/browser_use/agent/views.py
@@ -30,7 +30,7 @@ REQUIRED_LLM_API_ENV_VARS = {
'ChatGoogleGenerativeAI': ['GEMINI_API_KEY'],
'ChatDeepSeek': ['DEEPSEEK_API_KEY'],
'ChatOllama': [],
- 'ChatGrok':['GROK_API_KEY']
+ 'ChatGrok': ['GROK_API_KEY'],
}
diff --git a/browser_use/browser/browser.py b/browser_use/browser/browser.py
index 2103bd712..1a27486ea 100644
--- a/browser_use/browser/browser.py
+++ b/browser_use/browser/browser.py
@@ -133,7 +133,9 @@ class Browser:
async def new_context(self, config: BrowserContextConfig | None = None) -> BrowserContext:
"""Create a browser context"""
- return BrowserContext(config=config or BrowserContextConfig(**(self.config.model_dump() if self.config else {})), browser=self)
+ return BrowserContext(
+ config=config or BrowserContextConfig(**(self.config.model_dump() if self.config else {})), browser=self
+ )
async def get_playwright_browser(self) -> PlaywrightBrowser:
"""Get a browser context"""
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.py
index 51869bccf..6c76f7397 100644
--- a/browser_use/dom/service.py
+++ b/browser_use/dom/service.py
@@ -1,4 +1,3 @@
-import gc
import json
import logging
from dataclasses import dataclass
diff --git a/tests/test_browser.py b/tests/test_browser.py
index 7cc6ee46c..9a24d6d51 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -22,6 +22,7 @@ async def test_builtin_browser_launch(monkeypatch):
class DummyChromium:
async def launch(self, headless, args, proxy=None, handle_sigterm=False, handle_sigint=False):
return DummyBrowser()
+
class DummyPlaywright:
def __init__(self):
self.chromium = DummyChromium()