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
zach/chore: fix ruff
Ahmed Aly0d0eae16d2db
diff --git a/browser_use/dom/serializer/serializer.py b/browser_use/dom/serializer/serializer.pyindex f5a191977..4374dc43c 100644--- a/browser_use/dom/serializer/serializer.py+++ b/browser_use/dom/serializer/serializer.py@@ -1211,7 +1211,7 @@ class DOMTreeSerializer:# ALWAYS check AX tree - it reflects actual typed value, DOM attribute may not updateelif node.ax_node and node.ax_node.properties:for prop in node.ax_node.properties:- # Try valuetext first (human-readable display value)+ # Try valuetext first (human-readable display value)if prop.name == 'valuetext' and prop.value:value_str = str(prop.value).strip()if value_str:diff --git a/tests/ci/security/test_sensitive_data.py b/tests/ci/security/test_sensitive_data.pyindex 43aaaa9a0..3976e31da 100644--- a/tests/ci/security/test_sensitive_data.py+++ b/tests/ci/security/test_sensitive_data.py@@ -517,18 +517,14 @@ def test_password_field_value_excluded_from_dom_snapshot():ax_value=secret_password,)- attrs_str = DOMTreeSerializer._build_attributes_string(- node, list(DEFAULT_INCLUDE_ATTRIBUTES), ''- )+ attrs_str = DOMTreeSerializer._build_attributes_string(node, list(DEFAULT_INCLUDE_ATTRIBUTES), '')assert secret_password not in attrs_str, (f'Password "{secret_password}" leaked into DOM serialization! ''Password field values must be excluded from DOM snapshots sent to the LLM.')# The type attribute should still be present so the LLM knows it's a password field- assert 'type=password' in attrs_str, (- 'Password field type attribute should be preserved'- )+ assert 'type=password' in attrs_str, 'Password field type attribute should be preserved'def test_password_field_value_excluded_even_from_html_attributes():@@ -547,9 +543,7 @@ def test_password_field_value_excluded_even_from_html_attributes():ax_value=None, # no AX value, but HTML attribute has it)- attrs_str = DOMTreeSerializer._build_attributes_string(- node, list(DEFAULT_INCLUDE_ATTRIBUTES), ''- )+ attrs_str = DOMTreeSerializer._build_attributes_string(node, list(DEFAULT_INCLUDE_ATTRIBUTES), '')assert preset_password not in attrs_str, (f'Preset password "{preset_password}" leaked via HTML value attribute! '@@ -570,13 +564,9 @@ def test_text_input_value_preserved():ax_value=username,)- attrs_str = DOMTreeSerializer._build_attributes_string(- node, list(DEFAULT_INCLUDE_ATTRIBUTES), ''- )+ attrs_str = DOMTreeSerializer._build_attributes_string(node, list(DEFAULT_INCLUDE_ATTRIBUTES), '')- assert username in attrs_str, (- 'Non-password input values should be preserved in DOM snapshots'- )+ assert username in attrs_str, 'Non-password input values should be preserved in DOM snapshots'def test_password_field_without_type_attribute():@@ -595,10 +585,6 @@ def test_password_field_without_type_attribute():ax_value=value,)- attrs_str = DOMTreeSerializer._build_attributes_string(- node, list(DEFAULT_INCLUDE_ATTRIBUTES), ''- )+ attrs_str = DOMTreeSerializer._build_attributes_string(node, list(DEFAULT_INCLUDE_ATTRIBUTES), '')- assert value in attrs_str, (- 'Input without type attribute should preserve its value'- )+ assert value in attrs_str, 'Input without type attribute should preserve its value'