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
Add special handling for form elements in DOMTreeSerializer to prioritize current values from AX tree properties for inputs, textareas, and selects.
Magnus Müllerc4e69c223529
diff --git a/browser_use/dom/serializer/serializer.py b/browser_use/dom/serializer/serializer.pyindex a17a0f975..b9d04bc12 100644--- a/browser_use/dom/serializer/serializer.py+++ b/browser_use/dom/serializer/serializer.py@@ -1049,6 +1049,26 @@ class DOMTreeSerializer:except (AttributeError, ValueError):continue+ # Special handling for form elements - ensure current value is shown+ # For text inputs, textareas, and selects, prioritize showing the current value from AX tree+ if node.tag_name and node.tag_name.lower() in ['input', 'textarea', 'select']:+ # If value is not already set, try to get it from AX tree properties+ if 'value' not in attributes_to_include or not attributes_to_include.get('value'):+ if node.ax_node and node.ax_node.properties:+ for prop in node.ax_node.properties:+ # Try valuetext first (human-readable display value)+ if prop.name == 'valuetext' and prop.value:+ value_str = str(prop.value).strip()+ if value_str:+ attributes_to_include['value'] = value_str+ break+ # Also try 'value' property directly+ elif prop.name == 'value' and prop.value:+ value_str = str(prop.value).strip()+ if value_str:+ attributes_to_include['value'] = value_str+ break+if not attributes_to_include:return ''