Skip to content

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

Update default cross-origin iframe setting to False and adjust tree serialization depth handling

Magnus Müller3dcd3c4b0253
diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.py
index 40faf0d3d..9f00f5dfb 100644
--- a/browser_use/browser/profile.py
+++ b/browser_use/browser/profile.py
@@ -587,7 +587,7 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Bro
description='Window position to use for the browser x,y from the top left when headless=False.',
)
cross_origin_iframes: bool = Field(
- default=True,
+ default=False,
description='Enable cross-origin iframe support (OOPIF/Out-of-Process iframes). When False, only same-origin frames are processed to avoid complexity and hanging.',
)
diff --git a/browser_use/dom/serializer/serializer.py b/browser_use/dom/serializer/serializer.py
index 1c8ab2b64..19312e0c1 100644
--- a/browser_use/dom/serializer/serializer.py
+++ b/browser_use/dom/serializer/serializer.py
@@ -151,7 +151,7 @@ class DOMTreeSerializer:
if node.content_document:
simplified = SimplifiedNode(original_node=node, children=[])
for child in node.content_document.children_nodes or []:
- simplified_child = self._create_simplified_tree(child)
+ simplified_child = self._create_simplified_tree(child, depth + 1)
if simplified_child:
simplified.children.append(simplified_child)
return simplified