Skip to content

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

Update outdated function names

Magnus Müllerb53a7c116a6f
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.py
index b8abcfc3f..a8397b957 100644
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@ -318,7 +318,7 @@ class MessageManager:
break
# Handle different use_vision modes:
- # - "auto": Only include screenshot if explicitly requested by action (e.g., take_screenshot)
+ # - "auto": Only include screenshot if explicitly requested by action (e.g., screenshot)
# - True: Always include screenshot
# - False: Never include screenshot
include_screenshot = False
diff --git a/browser_use/agent/prompts.py b/browser_use/agent/prompts.py
index 2ea6cfa0d..879a8f35c 100644
--- a/browser_use/agent/prompts.py
+++ b/browser_use/agent/prompts.py
@@ -265,7 +265,7 @@ class AgentMessagePrompt:
# Check if current page is a PDF viewer and add appropriate message
pdf_message = ''
if self.browser_state.is_pdf_viewer:
- pdf_message = 'PDF viewer cannot be rendered. In this page, DO NOT use the extract_structured_data 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 requested
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 4868daaa8..5ac880632 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -255,8 +255,8 @@ class Agent(Generic[Context, AgentStructuredOutput]):
elif controller is not None:
self.tools = controller
else:
- # Exclude take_screenshot tool when use_vision=False
- exclude_actions = ['take_screenshot'] if use_vision is False else []
+ # Exclude screenshot tool when use_vision=False
+ exclude_actions = ['screenshot'] if use_vision is False else []
self.tools = Tools(exclude_actions=exclude_actions, display_files_in_done_text=display_files_in_done_text)
# Structured output
diff --git a/browser_use/browser/events.py b/browser_use/browser/events.py
index a89d9412c..397140f49 100644
--- a/browser_use/browser/events.py
+++ b/browser_use/browser/events.py
@@ -130,7 +130,7 @@ class ClickElementEvent(ElementSelectedEvent[dict[str, Any] | None]):
button: Literal['left', 'right', 'middle'] = 'left'
while_holding_ctrl: bool = Field(
default=False,
- description='Set True to open any link clicked in a new tab in the background, can use switch_tab(tab_id=None) after to focus it',
+ description='Set True to open any link clicked in a new tab in the background, can use switch(tab_id=None) after to focus it',
)
# click_count: int = 1 # TODO
# expect_download: bool = False # moved to downloads_watchdog.py
diff --git a/browser_use/browser/watchdogs/default_action_watchdog.py b/browser_use/browser/watchdogs/default_action_watchdog.py
index ee7048988..5167307f6 100644
--- a/browser_use/browser/watchdogs/default_action_watchdog.py
+++ b/browser_use/browser/watchdogs/default_action_watchdog.py
@@ -103,7 +103,7 @@ class DefaultActionWatchdog(BaseWatchdog):
# so we need to switch to the new tab to make the agent aware of the surprise new tab that was opened.
# when while_holding_ctrl=True we dont actually want to switch to it,
# we should match human expectations of ctrl+click which opens in the background,
- # so in multi_act it usually already sends [click_element_by_index(123, while_holding_ctrl=True), switch_tab(tab_id=None)] anyway
+ # so in multi_act it usually already sends [click_element_by_index(123, while_holding_ctrl=True), switch(tab_id=None)] anyway
from browser_use.browser.events import SwitchTabEvent
new_target_id = new_target_ids.pop()
@@ -258,7 +258,7 @@ 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 get_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 +2001,7 @@ 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_option(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/browser_use/mcp/server.py b/browser_use/mcp/server.py
index 1074f9329..63d241c6c 100644
--- a/browser_use/mcp/server.py
+++ b/browser_use/mcp/server.py
@@ -811,7 +811,7 @@ class BrowserUseServer:
state = await self.browser_session.get_browser_state_summary()
- # Use the extract_structured_data action
+ # Use the extract action
# Create a dynamic action model that matches the tools's expectations
from pydantic import create_model
@@ -819,13 +819,13 @@ class BrowserUseServer:
ExtractAction = create_model(
'ExtractAction',
__base__=ActionModel,
- extract_structured_data=dict[str, Any],
+ extract=dict[str, Any],
)
# Use model_validate because Pyright does not understand the dynamic model
action = ExtractAction.model_validate(
{
- 'extract_structured_data': {'query': query, 'extract_links': extract_links},
+ 'extract': {'query': query, 'extract_links': extract_links},
}
)
action_result = await self.tools.act(
diff --git a/browser_use/tools/registry/service.py b/browser_use/tools/registry/service.py
index 33bbd0342..f70ae6f2d 100644
--- a/browser_use/tools/registry/service.py
+++ b/browser_use/tools/registry/service.py
@@ -350,12 +350,12 @@ class Registry(Generic[Context]):
'browser_session': browser_session,
'page_extraction_llm': page_extraction_llm,
'available_file_paths': available_file_paths,
- 'has_sensitive_data': action_name == 'input_text' and bool(sensitive_data),
+ 'has_sensitive_data': action_name == 'input' and bool(sensitive_data),
'file_system': file_system,
}
- # Only pass sensitive_data to actions that explicitly need it (input_text)
- if action_name == 'input_text':
+ # Only pass sensitive_data to actions that explicitly need it (input)
+ if action_name == 'input':
special_context['sensitive_data'] = sensitive_data
# Add CDP-related parameters if browser_session is available
diff --git a/tests/ci/test_browser_event_GetDropdownOptionsEvent.py b/tests/ci/test_browser_event_GetDropdownOptionsEvent.py
index 078410350..2942192f6 100644
--- a/tests/ci/test_browser_event_GetDropdownOptionsEvent.py
+++ b/tests/ci/test_browser_event_GetDropdownOptionsEvent.py
@@ -319,7 +319,7 @@ class TestGetDropdownOptionsEvent:
assert option in result.extracted_content, f"Option '{option}' not found in result content"
# Verify instruction is included
- assert 'Use the exact text string' in result.extracted_content and 'select_dropdown_option' in result.extracted_content
+ assert 'Use the exact text string' in result.extracted_content and 'select_dropdown' in result.extracted_content
# Also test direct event dispatch
node = await browser_session.get_element_by_index(dropdown_index)
diff --git a/tests/ci/test_browser_event_GetDropdownOptionsEvent_aria_menus.py b/tests/ci/test_browser_event_GetDropdownOptionsEvent_aria_menus.py
index f74e656ca..98e120a3f 100644
--- a/tests/ci/test_browser_event_GetDropdownOptionsEvent_aria_menus.py
+++ b/tests/ci/test_browser_event_GetDropdownOptionsEvent_aria_menus.py
@@ -212,8 +212,8 @@ class TestARIAMenuDropdown:
for option in expected_options:
assert option in result.extracted_content, f"Option '{option}' not found in result content"
- # Verify the instruction for using the text in select_dropdown_option is included
- assert 'Use the exact text string in select_dropdown_option' in result.extracted_content
+ # Verify the instruction for using the text in select_dropdown is included
+ assert 'Use the exact text string in select_dropdown' in result.extracted_content
@pytest.mark.skip(reason='TODO: fix')
async def test_select_dropdown_option_with_aria_menu(self, tools, browser_session: BrowserSession, base_url):
@@ -347,4 +347,4 @@ class TestARIAMenuDropdown:
assert result.extracted_content is not None
# The action should return some menu options
- assert 'Use the exact text string in select_dropdown_option' in result.extracted_content
+ assert 'Use the exact text string in select_dropdown' in result.extracted_content
diff --git a/tests/ci/test_tools.py b/tests/ci/test_tools.py
index 8586ef410..d2dae1c6e 100644
--- a/tests/ci/test_tools.py
+++ b/tests/ci/test_tools.py
@@ -454,10 +454,10 @@ class TestToolsIntegration:
for option in expected_options[1:]: # Skip the placeholder option
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_option is included
+ # 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_option' in result.extracted_content
+ and 'select_dropdown' in result.extracted_content
)
# Verify the actual dropdown options in the DOM using CDP