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
If aria-expanded and expanded only keep expanded
Magnus Müllerbe9a0851a554
diff --git a/browser_use/dom/serializer/serializer.py b/browser_use/dom/serializer/serializer.pyindex 7c990c04f..c21229f67 100644--- a/browser_use/dom/serializer/serializer.py+++ b/browser_use/dom/serializer/serializer.py@@ -951,6 +951,10 @@ class DOMTreeSerializer:if 'invalid' in attributes_to_include and attributes_to_include['invalid'].lower() == 'false':del attributes_to_include['invalid']+ # Remove aria-expanded if we have expanded (prefer AX tree over HTML attribute)+ if 'expanded' in attributes_to_include and 'aria-expanded' in attributes_to_include:+ del attributes_to_include['aria-expanded']+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():