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
Linter
Magnus Müller7f2e9fc4c321
diff --git a/browser_use/actor/page.py b/browser_use/actor/page.pyindex b45fd7a4b..701f352e2 100644--- a/browser_use/actor/page.py+++ b/browser_use/actor/page.py@@ -523,6 +523,6 @@ You will be given a query and the markdown of a webpage that has been filtered tUses the shared markdown extractor for consistency with tools/service.py."""from browser_use.dom.markdown_extractor import extract_clean_markdown-+dom_service = self.dom_servicereturn await extract_clean_markdown(dom_service=dom_service, target_id=self._target_id, extract_links=extract_links)diff --git a/browser_use/dom/markdown_extractor.py b/browser_use/dom/markdown_extractor.pyindex 9baf673bb..1389b19e2 100644--- a/browser_use/dom/markdown_extractor.py+++ b/browser_use/dom/markdown_extractor.py@@ -6,7 +6,7 @@ used by both the tools service and page actor."""import re-from typing import TYPE_CHECKING, Any, Dict, Tuple+from typing import TYPE_CHECKING, Anyfrom browser_use.dom.serializer.html_serializer import HTMLSerializerfrom browser_use.dom.service import DomService@@ -21,7 +21,7 @@ async def extract_clean_markdown(dom_service: DomService | None = None,target_id: str | None = None,extract_links: bool = False,-) -> Tuple[str, Dict[str, Any]]:+) -> tuple[str, dict[str, Any]]:"""Extract clean markdown from browser content using enhanced DOM tree.This unified function can extract markdown using either a browser session (for tools service)@@ -126,7 +126,7 @@ async def _get_enhanced_dom_tree_from_browser_session(browser_session: 'BrowserS# Legacy aliases removed - all code now uses the unified extract_clean_markdown function-def _preprocess_markdown_content(content: str, max_newlines: int = 3) -> Tuple[str, int]:+def _preprocess_markdown_content(content: str, max_newlines: int = 3) -> tuple[str, int]:"""Light preprocessing of markdown output - minimal cleanup with JSON blob removal.