Skip to content

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

fixed nasty error with null values

Gregor Žuničd5ee99d91d82
diff --git a/browser_use/dom/dom_tree/index.js b/browser_use/dom/dom_tree/index.js
index 04d6d6751..a1350d683 100644
--- a/browser_use/dom/dom_tree/index.js
+++ b/browser_use/dom/dom_tree/index.js
@@ -1261,7 +1261,7 @@
* @type {
{
tagName: string;
- attributes: Record<string, string>;
+ attributes: Record<string, string | null>;
xpath: any;
children: never[];
isVisible?: boolean;
@@ -1285,9 +1285,7 @@
const attributeNames = node.getAttributeNames?.() || [];
for (const name of attributeNames) {
const value = node.getAttribute(name);
- if (value) {
- nodeData.attributes[name] = value;
- }
+ nodeData.attributes[name] = value;
}
}