Skip to content

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

Basic editable properties

Magnus Müller4ceb2eb2528a
diff --git a/browser_use/dom/serializer/clickable_elements.py b/browser_use/dom/serializer/clickable_elements.py
index abf0bbd3e..608154d2b 100644
--- a/browser_use/dom/serializer/clickable_elements.py
+++ b/browser_use/dom/serializer/clickable_elements.py
@@ -11,8 +11,8 @@ class ClickableElementDetector:
return False
# Primary check: snapshot data from Chrome's heuristics
- if node.snapshot_node and node.snapshot_node.is_clickable:
- return True
+ # if node.snapshot_node and node.snapshot_node.is_clickable:
+ # return True
# remove html and body nodes
if node.tag_name in {'html', 'body'}:
@@ -67,6 +67,31 @@ class ClickableElementDetector:
if node.ax_node.role in interactive_ax_roles:
return True
+ # Enhanced accessibility property checks - direct clear indicators only
+ if node.ax_node and node.ax_node.properties:
+ for prop in node.ax_node.properties:
+ try:
+ # Direct interactiveness indicators
+ if prop.name in ['focusable', 'editable', 'settable'] and prop.value:
+ return True
+
+ # Interactive state properties (presence indicates interactive widget)
+ if prop.name in ['checked', 'expanded', 'pressed', 'selected']:
+ # These properties only exist on interactive elements
+ return True
+
+ # Form-related interactiveness
+ if prop.name in ['required', 'autocomplete'] and prop.value:
+ return True
+
+ # Elements with keyboard shortcuts are interactive
+ if prop.name == 'keyshortcuts' and prop.value:
+ return True
+
+ except (AttributeError, ValueError):
+ # Skip properties we can't process
+ continue
+
# Final check: cursor style indicates interactivity
if node.snapshot_node and node.snapshot_node.cursor_style and node.snapshot_node.cursor_style == 'pointer':
return True
diff --git a/browser_use/dom/views.py b/browser_use/dom/views.py
index f6cd801c8..4a99b01a3 100644
--- a/browser_use/dom/views.py
+++ b/browser_use/dom/views.py
@@ -8,7 +8,7 @@ from cdp_use.cdp.dom.types import ShadowRootType
from browser_use.dom.utils import cap_text_length
-### Serializer types
+# Serializer types
DEFAULT_INCLUDE_ATTRIBUTES = [
'title',
'type',
@@ -63,6 +63,14 @@ class NodeType(int, Enum):
NOTATION_NODE = 12
+@dataclass(slots=True)
+class DOMRect:
+ x: float
+ y: float
+ width: float
+ height: float
+
+
@dataclass(slots=True)
class EnhancedAXProperty:
"""we don't need `sources` and `related_nodes` for now (not sure how to use them)
@@ -88,24 +96,6 @@ class EnhancedAXNode:
properties: list[EnhancedAXProperty] | None
-@dataclass
-class DOMCoordinates:
- x: float
- y: float
-
-
-@dataclass(slots=True)
-class DOMRect:
- x: float
- y: float
- width: float
- height: float
-
- @property
- def center(self) -> DOMCoordinates:
- return DOMCoordinates(x=self.x + self.width / 2, y=self.y + self.height / 2)
-
-
@dataclass(slots=True)
class EnhancedSnapshotNode:
"""Snapshot data extracted from DOMSnapshot for enhanced functionality."""
@@ -117,7 +107,7 @@ class EnhancedSnapshotNode:
"""
Document coordinates (origin = top-left of the page, ignores current scroll).
Equivalent JS API: layoutNode.boundingBox in the older API.
- Typical use: Quick hit-test that doesn’t care about scroll position.
+ Typical use: Quick hit-test that doesn't care about scroll position.
"""
# clientRects: DOMRect | None
@@ -165,20 +155,20 @@ class EnhancedDOMTreeNode:
Whether the node is scrollable.
"""
- ## frames
+ # frames
frame_id: str | None
content_document: 'EnhancedDOMTreeNode | None'
"""
Content document is the document inside a new iframe.
"""
- ## Shadow DOM
+ # Shadow DOM
shadow_root_type: ShadowRootType | None
shadow_roots: list['EnhancedDOMTreeNode'] | None
"""
Shadow roots are the shadow DOMs of the element.
"""
- ## Navigation
+ # Navigation
parent_node: 'EnhancedDOMTreeNode | None'
children_nodes: list['EnhancedDOMTreeNode'] | None