Skip to content

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

Update buildDomTree.js

Matic Zavadlal4d1040d073c6
diff --git a/browser_use/dom/buildDomTree.js b/browser_use/dom/buildDomTree.js
index 313a10a9e..003eed567 100644
--- a/browser_use/dom/buildDomTree.js
+++ b/browser_use/dom/buildDomTree.js
@@ -520,15 +520,15 @@
if (node.nodeType === Node.TEXT_NODE) {
const textContent = node.textContent.trim();
if (textContent && isTextNodeVisible(node)) {
- const id = ID.current++;
+ const id = `${ID.current++}`;
- DOM_HASH_MAP[`${id}`] = {
+ DOM_HASH_MAP[id] = {
type: "TEXT_NODE",
text: textContent,
isVisible: true,
};
- return `${id}`;
+ return id;
}
return null;
}
@@ -691,10 +691,10 @@
}
// NOTE: We register the node to the hash map.
- const id = ID.current++;
- DOM_HASH_MAP[`${id}`] = nodeData;
+ const id = `${ID.current++}`;
+ DOM_HASH_MAP[id] = nodeData;
- return `${id}`;
+ return id;
}
const rootId = buildDomTree(document.body);