Skip to content

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

fix(dom): fix stackingContexts access type mismatch

itxaiohanglovere866f144a7b6
diff --git a/browser_use/dom/enhanced_snapshot.py b/browser_use/dom/enhanced_snapshot.py
index ecb110c6d..881f1c794 100644
--- a/browser_use/dom/enhanced_snapshot.py
+++ b/browser_use/dom/enhanced_snapshot.py
@@ -162,7 +162,7 @@ def build_snapshot_lookup(
# Extract stacking contexts if available
if layout_idx < len(layout.get('stackingContexts', [])):
- stacking_contexts = layout.get('stackingContexts', {}).get('index', [])[layout_idx]
+ stacking_contexts = layout.get('stackingContexts', [])[layout_idx]
snapshot_lookup[backend_node_id] = EnhancedSnapshotNode(
is_clickable=is_clickable,