Skip to content

fix: index elements inside cross-origin iframes reliably#4452

Merged
sauravpanda merged 2 commits into
mainfrom
iframe-click-issue
Mar 22, 2026
Merged

fix: index elements inside cross-origin iframes reliably#4452
sauravpanda merged 2 commits into
mainfrom
iframe-click-issue

Conversation

@sauravpanda
Copy link
Copy Markdown
Collaborator

@sauravpanda sauravpanda commented Mar 21, 2026

Summary by cubic

Make cross-origin iframe indexing reliable so elements inside them are included consistently. Handles dynamic iframes and target-attachment races to prevent missing content during DOM builds.

  • Bug Fixes
    • Fallback to matching iframes by sanitized src when frameId is missing or not yet in all_frames.
    • Use frameTargetId directly; fetch details via get_target() when available and fall back to frame metadata if not.
    • Remove race in target tracking by creating/updating Target inside the same lock as _target_sessions.
    • Skip detached targets in get_all_frames() by catching ValueError, and wrap iframe DOM recursion in try/except to avoid failing the whole tree.

Written for commit 03de83a. Summary will update on new commits.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 21, 2026

Agent Task Evaluation Results: 2/2 (100%)

View detailed results
Task Result Reason
amazon_laptop ✅ Pass Skipped - API key not available (fork PR or missing secret)
browser_use_pip ✅ Pass Skipped - API key not available (fork PR or missing secret)

Check the evaluate-tasks job for detailed task execution logs.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="browser_use/dom/service.py">

<violation number="1" location="browser_use/dom/service.py:950">
P2: The src-based frame fallback can select the wrong iframe when multiple frames share the same URL; only unique URL matches should be used.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread browser_use/dom/service.py
@sauravpanda sauravpanda merged commit f66dc67 into main Mar 22, 2026
86 checks passed
@sauravpanda sauravpanda deleted the iframe-click-issue branch March 22, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant