Skip to content

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

Update docstrings for click_element_by_index and input_text actions to clarify usage restrictions regarding browser_state indices.

Magnus Müller3dac24ddec3b
diff --git a/browser_use/tools/service.py b/browser_use/tools/service.py
index 492c8c2c5..e685a0f2c 100644
--- a/browser_use/tools/service.py
+++ b/browser_use/tools/service.py
@@ -263,7 +263,7 @@ class Tools(Generic[Context]):
# Element Interaction Actions
@self.registry.action(
- 'Click element by index, set while_holding_ctrl=True to open any resulting navigation in a new tab. Only click on indices that are inside your current browser_state. Never click or assume not existing indices.',
+ 'Click element by index. Only indices from your browser_state are allowed. Never use and index that is not inside your current browser_state. Set while_holding_ctrl=True to open any resulting navigation in a new tab.',
param_model=ClickElementAction,
)
async def click_element_by_index(params: ClickElementAction, browser_session: BrowserSession):
@@ -314,7 +314,7 @@ class Tools(Generic[Context]):
return ActionResult(error=error_msg)
@self.registry.action(
- 'Click and input text into a input interactive element. Only input text into indices that are inside your current browser_state. Never input text into indices that are not inside your current browser_state.',
+ 'Input text into an input interactive element. Only input text into indices that are inside your current browser_state. Never input text into indices that are not inside your current browser_state.',
param_model=InputTextAction,
)
async def input_text(params: InputTextAction, browser_session: BrowserSession, has_sensitive_data: bool = False):