Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
refactor: update all_frames parameter handling in DomService
reformedot13868aee9b96
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.pyindex 843749b0c..1c060d018 100644--- a/browser_use/dom/service.py+++ b/browser_use/dom/service.py@@ -475,7 +475,7 @@ class DomService:node: Node,html_frames: list[EnhancedDOMTreeNode] | None,total_frame_offset: DOMRect | None,- all_frames: dict,+ all_frames: dict | None,) -> EnhancedDOMTreeNode:"""Recursively construct enhanced DOM tree nodes.@@ -728,12 +728,9 @@ class DomService:return dom_tree_node- # Ensure all_frames is available (lazy fetch if needed at top level)- # Most pages won't need this (no cross-origin iframes), so we defer the call- if all_frames is None:- all_frames = {} # Empty dict for non-cross-origin-iframe pages-# Build enhanced DOM tree recursively+ # Note: all_frames stays None and will be lazily fetched inside _construct_enhanced_node+ # only if/when a cross-origin iframe is encounteredstart_construct = time.time()enhanced_dom_tree_node = await _construct_enhanced_node(dom_tree['root'], initial_html_frames, initial_total_frame_offset, all_frames