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
Remove type if same as tag
Magnus Müllerca0bc33b4214
diff --git a/browser_use/dom/serializer/serializer.py b/browser_use/dom/serializer/serializer.pyindex 835beed7b..548e17814 100644--- a/browser_use/dom/serializer/serializer.py+++ b/browser_use/dom/serializer/serializer.py@@ -943,6 +943,10 @@ class DOMTreeSerializer:if role and node.node_name == role:attributes_to_include.pop('role', None)+ # Remove type attribute if it matches the tag name (e.g. <button type="button">)+ if 'type' in attributes_to_include and attributes_to_include['type'].lower() == node.node_name.lower():+ del attributes_to_include['type']+attrs_to_remove_if_text_matches = ['aria-label', 'placeholder', 'title']for attr in attrs_to_remove_if_text_matches:if attributes_to_include.get(attr) and attributes_to_include.get(attr, '').strip().lower() == text.strip().lower():