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üller324ac7420497
diff --git a/.gitignore b/.gitignoreindex b2c71bb34..9f7ac4c49 100644--- a/.gitignore+++ b/.gitignore@@ -65,3 +65,5 @@ all_github_issues_progress.mdall_github_issues.mdtodo-input-token.md++TOOL_CHANGES_SUMMARY.md\ No newline at end of filediff --git a/browser_use/agent/prompts.py b/browser_use/agent/prompts.pyindex 879a8f35c..49ea5c8bd 100644--- a/browser_use/agent/prompts.py+++ b/browser_use/agent/prompts.py@@ -265,7 +265,9 @@ class AgentMessagePrompt:# Check if current page is a PDF viewer and add appropriate messagepdf_message = ''if self.browser_state.is_pdf_viewer:- pdf_message = 'PDF viewer cannot be rendered. In this page, DO NOT use the extract action as PDF content cannot be rendered. '+ pdf_message = (+ 'PDF viewer cannot be rendered. In this page, DO NOT use the extract action as PDF content cannot be rendered. '+ )pdf_message += 'Use the read_file action on the downloaded PDF in available_file_paths to read the full text content or scroll in the page to see images/figures if needed.\n\n'# Add recent events if available and requesteddiff --git a/browser_use/browser/watchdogs/default_action_watchdog.py b/browser_use/browser/watchdogs/default_action_watchdog.pyindex 5167307f6..1463ac043 100644--- a/browser_use/browser/watchdogs/default_action_watchdog.py+++ b/browser_use/browser/watchdogs/default_action_watchdog.py@@ -258,7 +258,9 @@ class DefaultActionWatchdog(BaseWatchdog):element_type = element_node.attributes.get('type', '').lower() if element_node.attributes else ''if tag_name == 'select':- msg = f'Cannot click on <select> elements. Use dropdown_options(index={element_node.element_index}) action instead.'+ msg = (+ f'Cannot click on <select> elements. Use dropdown_options(index={element_node.element_index}) action instead.'+ )self.logger.warning(msg)raise BrowserError(message=msg,@@ -2001,7 +2003,9 @@ class DefaultActionWatchdog(BaseWatchdog):msg = f'Found {dropdown_type} dropdown ({element_info}):\n' + '\n'.join(formatted_options)else:msg = f'Found {dropdown_type} dropdown in {source_info} ({element_info}):\n' + '\n'.join(formatted_options)- msg += f'\n\nUse the exact text or value string (without quotes) in select_dropdown(index={index_for_logging}, text=...)'+ msg += (+ f'\n\nUse the exact text or value string (without quotes) in select_dropdown(index={index_for_logging}, text=...)'+ )if source_info == 'target':self.logger.info(f'📋 Found {len(dropdown_data["options"])} dropdown options for index {index_for_logging}')diff --git a/docs/customize/agent/all-parameters.mdx b/docs/customize/agent/all-parameters.mdxindex 0f31dbb6e..bb0213f9e 100644--- a/docs/customize/agent/all-parameters.mdx+++ b/docs/customize/agent/all-parameters.mdx@@ -13,7 +13,7 @@ mode: "wide"- `output_model_schema`: Pydantic model class for structured output validation. [Example](https://github.com/browser-use/browser-use/blob/main/examples/features/custom_output.py)### Vision & Processing-- `use_vision` (default: `"auto"`): Vision mode - `"auto"` includes take_screenshot tool but only uses vision when requested, `True` always includes screenshots, `False` never includes screenshots and excludes take_screenshot tool+- `use_vision` (default: `"auto"`): Vision mode - `"auto"` includes screenshot tool but only uses vision when requested, `True` always includes screenshots, `False` never includes screenshots and excludes screenshot tool- `vision_detail_level` (default: `'auto'`): Screenshot detail level - `'low'`, `'high'`, or `'auto'`- `page_extraction_llm`: Separate LLM model for page content extraction. You can choose a small & fast model because it only needs to extract text from the page (default: same as `llm`)diff --git a/tests/ci/test_tools.py b/tests/ci/test_tools.pyindex d2dae1c6e..a25421e5b 100644--- a/tests/ci/test_tools.py+++ b/tests/ci/test_tools.py@@ -455,10 +455,7 @@ class TestToolsIntegration:assert option['text'] in result.extracted_content, f"Option '{option['text']}' not found in result content"# Verify the instruction for using the text in select_dropdown is included- assert (- 'Use the exact text or value string' in result.extracted_content- and 'select_dropdown' in result.extracted_content- )+ assert 'Use the exact text or value string' in result.extracted_content and 'select_dropdown' in result.extracted_content# Verify the actual dropdown options in the DOM using CDPdropdown_options_result = await cdp_session.cdp_client.send.Runtime.evaluate(