Skip to content

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

Check if text node is visable

Magnus Müller52d82008e485
diff --git a/browser_use/dom/buildDomTree.js b/browser_use/dom/buildDomTree.js
index bf4133a9d..8ed92e6b0 100644
--- a/browser_use/dom/buildDomTree.js
+++ b/browser_use/dom/buildDomTree.js
@@ -626,14 +626,13 @@
// Special case for text nodes
if (node.nodeType === Node.TEXT_NODE) {
const textContent = node.textContent.trim();
- if (textContent) { // && isTextNodeVisible(node)
+ if (textContent ) { //
const id = `${ID.current++}`;
DOM_HASH_MAP[id] = {
type: "TEXT_NODE",
text: textContent,
- isVisible: true,
-
+ isVisible: isTextNodeVisible(node),
};
return id;