Skip to content

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

Remove [] for none interactive

Magnus Müller7c0df13a4dd5
diff --git a/browser_use/agent/system_prompt.md b/browser_use/agent/system_prompt.md
index f1ac82899..b975b5093 100644
--- a/browser_use/agent/system_prompt.md
+++ b/browser_use/agent/system_prompt.md
@@ -11,9 +11,9 @@ Interactive Elements
- text: Element description
Example:
[33]<button>Submit Form</button>
-[] Non-interactive text
+
- Only elements with numeric indexes in [] are interactive
-- [] elements provide only context
+- elements without [] provide only context
# Response Rules
1. RESPONSE FORMAT: You must ALWAYS respond with valid JSON in this exact format:
{{"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. Mention if something unexpected happened. Shortly state why/why not",
diff --git a/browser_use/dom/views.py b/browser_use/dom/views.py
index 99c3f9a5c..6118262e3 100644
--- a/browser_use/dom/views.py
+++ b/browser_use/dom/views.py
@@ -153,7 +153,7 @@ class DOMElementNode(DOMBaseNode):
elif isinstance(node, DOMTextNode):
# Add text only if it doesn't have a highlighted parent
if not node.has_parent_with_highlight_index() and node.is_visible: # and node.is_parent_top_element()
- formatted_text.append(f'[]{node.text}')
+ formatted_text.append(f'{node.text}')
process_node(self, 0)
return '\n'.join(formatted_text)