Skip to content

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

fix lint

Nick Sweeting3af0a40fa242
diff --git a/browser_use/dom/views.py b/browser_use/dom/views.py
index 50e59c84d..3d2cfece4 100644
--- a/browser_use/dom/views.py
+++ b/browser_use/dom/views.py
@@ -223,10 +223,7 @@ class DOMElementNode(DOMBaseNode):
elif isinstance(node, DOMTextNode):
# Add text only if it doesn't have a highlighted parent
if (
- node.parent.highlight_index is None
- and node.parent
- and node.parent.is_visible
- and node.parent.is_top_element
+ node.parent.highlight_index is None and node.parent and node.parent.is_visible and node.parent.is_top_element
): # and node.is_parent_top_element()
formatted_text.append(f'{depth_str}{node.text}')