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
Change notation from _[:] to []
magmueller215dd81571d6
diff --git a/browser_use/agent/prompts.py b/browser_use/agent/prompts.pyindex 8cb6c5402..b45dc401a 100644--- a/browser_use/agent/prompts.py+++ b/browser_use/agent/prompts.py@@ -22,7 +22,7 @@ class SystemPrompt:{"current_state": {"evaluation_previous_goal": "Success|Failed|Unknown - Analyze the current elements and the image to check if the previous goals/actions are successful like intended by the task. Ignore the action result. The website is the ground truth. Also mention if something unexpected happened like new suggestions in an input field. Shortly state why/why not",- "memory": "Description of what has been done and what you need to remember. Count here ALWAYS how many times you have done something and how many remain. E.g. 0 out of 10 websites analyzed. Continue with abc and xyz",+ "memory": "Description of what has been done and what you need to remember. Be very specific. Count here ALWAYS how many times you have done something and how many remain. E.g. 0 out of 10 websites analyzed. Continue with abc and xyz","next_goal": "What needs to be done with the next actions"},"action": [@@ -52,8 +52,8 @@ class SystemPrompt:3. ELEMENT INTERACTION:- Only use indexes that exist in the provided element list- - Each element has a unique index number (e.g., "33[:]<button>")- - Elements marked with "_[:]" are non-interactive (for context only)+ - Each element has a unique index number (e.g., "[33]<button>")+ - Elements marked with "[]Non-interactive text" are non-interactive (for context only)4. NAVIGATION & ERROR HANDLING:- If no suitable elements exist, use other functions to complete the task@@ -105,13 +105,13 @@ INPUT STRUCTURE:- element_text: Visible text or element descriptionExample:-33[:]<button>Submit Form</button>-_[:] Non-interactive text+[33]<button>Submit Form</button>+[] Non-interactive textNotes:-- Only elements with numeric indexes are interactive-- _[:] elements provide context but cannot be interacted with+- Only elements with numeric indexes inside [] are interactive+- [] elements provide context but cannot be interacted with"""def get_system_message(self) -> SystemMessage:diff --git a/browser_use/dom/views.py b/browser_use/dom/views.pyindex 20921221d..54cd19e81 100644--- a/browser_use/dom/views.py+++ b/browser_use/dom/views.py@@ -115,7 +115,7 @@ class DOMElementNode(DOMBaseNode):f'{key}="{value}"' for key, value in node.attributes.items() if key in include_attributes)formatted_text.append(- f'{node.highlight_index}[:]<{node.tag_name}{attributes_str}>{node.get_all_text_till_next_clickable_element()}</{node.tag_name}>'+ f'[{node.highlight_index}]<{node.tag_name}{attributes_str}>{node.get_all_text_till_next_clickable_element()}</{node.tag_name}>')# Process children regardless@@ -125,7 +125,7 @@ class DOMElementNode(DOMBaseNode):elif isinstance(node, DOMTextNode):# Add text only if it doesn't have a highlighted parentif not node.has_parent_with_highlight_index():- formatted_text.append(f'_[:]{node.text}')+ formatted_text.append(f'[]{node.text}')process_node(self, 0)return '\n'.join(formatted_text)