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
Update search google
Magnus Müllerdc34a5edb04d
diff --git a/browser_use/tools/views.py b/browser_use/tools/views.pyindex fad1d4e06..67a11d55a 100644--- a/browser_use/tools/views.py+++ b/browser_use/tools/views.py@@ -10,7 +10,7 @@ class SearchAction(BaseModel):# Backward compatibility alias-SearchGoogleAction = SearchAction+SearchAction = SearchActionclass GoToUrlAction(BaseModel):diff --git a/docs/customize/tools/available.mdx b/docs/customize/tools/available.mdxindex 2c8e0967e..5be81ece7 100644--- a/docs/customize/tools/available.mdx+++ b/docs/customize/tools/available.mdx@@ -9,7 +9,7 @@ mode: "wide"### Navigation & Browser Control-- **`search_google`** - Search queries in Google+- **`search`** - Search queries in Google- **`go_to_url`** - Navigate to URLs- **`go_back`** - Go back in browser history- **`wait`** - Wait for specified secondsdiff --git a/docs/customize/tools/remove.mdx b/docs/customize/tools/remove.mdxindex 2d29d9970..804a74c55 100644--- a/docs/customize/tools/remove.mdx+++ b/docs/customize/tools/remove.mdx@@ -9,6 +9,6 @@ mode: "wide"```pythonfrom browser_use import Tools-tools = Tools(exclude_actions=['search_google', 'wait'])+tools = Tools(exclude_actions=['search', 'wait'])agent = Agent(task='...', llm=llm, tools=tools)```diff --git a/examples/use-cases/find_influencer_profiles.py b/examples/use-cases/find_influencer_profiles.pyindex 1f90bf16a..4510b68ee 100644--- a/examples/use-cases/find_influencer_profiles.py+++ b/examples/use-cases/find_influencer_profiles.py@@ -31,7 +31,7 @@ class Profiles(BaseModel):profiles: list[Profile]-tools = Tools(exclude_actions=['search_google'], output_model=Profiles)+tools = Tools(exclude_actions=['search'], output_model=Profiles)BEARER_TOKEN = os.getenv('BEARER_TOKEN')if not BEARER_TOKEN:diff --git a/tests/ci/test_registry.py b/tests/ci/test_registry.pyindex be35cf5e9..5fb1bfb10 100644--- a/tests/ci/test_registry.py+++ b/tests/ci/test_registry.py@@ -28,7 +28,7 @@ from browser_use.tools.views import (ClickElementAction,InputTextAction,NoParamsAction,- SearchGoogleAction,+ SearchAction,)from tests.ci.conftest import create_mock_llm@@ -485,8 +485,8 @@ class TestExistingToolsActions:async def test_existing_action_models(self, registry, browser_session):"""Test that existing action parameter models work correctly"""- @registry.action('Test search', param_model=SearchGoogleAction)- async def test_search(params: SearchGoogleAction, browser_session: BrowserSession):+ @registry.action('Test search', param_model=SearchAction)+ async def test_search(params: SearchAction, browser_session: BrowserSession):return ActionResult(extracted_content=f'Searched for: {params.query}')@registry.action('Test click', param_model=ClickElementAction)diff --git a/tests/ci/test_tools.py b/tests/ci/test_tools.pyindex bd4378b4e..3de0ac1de 100644--- a/tests/ci/test_tools.py+++ b/tests/ci/test_tools.py@@ -15,7 +15,7 @@ from browser_use.tools.views import (DoneAction,GoToUrlAction,NoParamsAction,- SearchGoogleAction,+ SearchAction,)@@ -97,7 +97,7 @@ class TestToolsIntegration:# Check that common actions are registeredcommon_actions = ['go_to_url',- 'search_google',+ 'search','click_element_by_index','input_text','scroll',@@ -286,28 +286,28 @@ class TestToolsIntegration:async def test_excluded_actions(self, browser_session):"""Test that excluded actions are not registered."""# Create tools with excluded actions- excluded_tools = Tools(exclude_actions=['search_google', 'scroll'])+ excluded_tools = Tools(exclude_actions=['search', 'scroll'])# Verify excluded actions are not in the registry- assert 'search_google' not in excluded_tools.registry.registry.actions+ assert 'search' not in excluded_tools.registry.registry.actionsassert 'scroll' not in excluded_tools.registry.registry.actions# But other actions are still thereassert 'go_to_url' in excluded_tools.registry.registry.actionsassert 'click_element_by_index' in excluded_tools.registry.registry.actions- async def test_search_google_action(self, tools, browser_session, base_url):- """Test the search_google action."""+ async def test_search_action(self, tools, browser_session, base_url):+ """Test the search action."""await browser_session.get_current_page_url()- # Execute search_google action - it will actually navigate to our search results page- search_action = {'search_google': SearchGoogleAction(query='Python web automation')}+ # Execute search action - it will actually navigate to our search results page+ search_action = {'search': SearchAction(query='Python web automation')}- class SearchGoogleActionModel(ActionModel):- search_google: SearchGoogleAction | None = None+ class SearchActionModel(ActionModel):+ search: SearchAction | None = None- result = await tools.act(SearchGoogleActionModel(**search_action), browser_session)+ result = await tools.act(SearchActionModel(**search_action), browser_session)# Verify the resultassert isinstance(result, ActionResult)