Skip to content

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

fix(dom): allow smaller embedded controls

MagMuellere4d0818652e3
diff --git a/browser_use/dom/service.py b/browser_use/dom/service.py
index f8858e669..7bdc9ffdf 100644
--- a/browser_use/dom/service.py
+++ b/browser_use/dom/service.py
@@ -34,8 +34,8 @@ if TYPE_CHECKING:
_MAX_JS_CLICK_LISTENER_ELEMENTS = 100
_DESCRIBE_NODE_BATCH_SIZE = 20
_JS_CLICK_LISTENER_OVERFLOW = '__browser_use_too_many_click_listeners__'
-_MIN_CROSS_ORIGIN_IFRAME_AREA = 50 * 50
-_MIN_CROSS_ORIGIN_IFRAME_EDGE = 10
+_MIN_CROSS_ORIGIN_IFRAME_AREA = 16 * 16
+_MIN_CROSS_ORIGIN_IFRAME_EDGE = 8
def _is_cross_origin_iframe_size_eligible(width: float, height: float) -> bool:
diff --git a/tests/ci/test_dom_visibility.py b/tests/ci/test_dom_visibility.py
index c7e3d48b1..1f90e1cf7 100644
--- a/tests/ci/test_dom_visibility.py
+++ b/tests/ci/test_dom_visibility.py
@@ -116,6 +116,9 @@ class TestCrossOriginIframeSizeEligibility:
"""Area alone must not admit a one-pixel tracking iframe."""
assert _is_cross_origin_iframe_size_eligible(width=1, height=2500) is False
- def test_preserves_previous_minimum_area(self):
- assert _is_cross_origin_iframe_size_eligible(width=50, height=50) is True
- assert _is_cross_origin_iframe_size_eligible(width=49, height=49) is False
+ def test_accepts_small_interactive_frame(self):
+ assert _is_cross_origin_iframe_size_eligible(width=16, height=16) is True
+
+ def test_rejects_frames_below_the_area_or_edge_floor(self):
+ assert _is_cross_origin_iframe_size_eligible(width=15, height=15) is False
+ assert _is_cross_origin_iframe_size_eligible(width=7, height=100) is False