Skip to content

Browser Use cannot inspect, screenshot, or click visible cross-origin iframe content in Codex app #21144

Open

Description

@BradenHartsell

Summary

In the Codex app, Browser Use with the in-app browser (iab) can attach to the selected tab and inspect the parent page, but cannot operate on the visible content when the meaningful app surface is inside a cross-origin iframe.

This caused a Browser Use task to become impossible without changing the page or using a non-Browser-Use workaround. The agent could see the parent page and the iframe element, but could not inspect the iframe DOM, could not click into the iframe, and screenshot capture returned the Codex shell/sidebar rather than the actual browser viewport.

Environment / Context

  • Product surface: Codex desktop app / in-app browser
  • Browser Use backend: iab
  • Current tab URL:
    https://vibecodr.space/player/110503ee-044c-43e2-ab0d-ea8235f08b04
  • Page title reported by Browser Use:
    Ultimate Tic-Tak-Toe | Vibecodr Player
  • Meaningful app content is embedded in a cross-origin iframe:
    https://c-f405ee78-99b0-4ed2-a897-e1d00bb0d44c-rt.vxbe.space/__vibecodr/frame?artifactId=41bc68d9-351e-4c86-be84-7fe6b52c98d3
  • The user explicitly required preserving the current page, not opening the iframe directly, not reading source code, not changing settings, and not navigating away.

What Worked

Browser Use successfully attached to the selected in-app browser tab:

{
  "ok": true,
  "title": "Ultimate Tic-Tak-Toe | Vibecodr Player",
  "url": "https://vibecodr.space/player/110503ee-044c-43e2-ab0d-ea8235f08b04"
}

The parent DOM exposed the player shell and iframe:

- heading "Ultimate Tic-Tak-Toe" [level=1]
- generic "Dedicated cross-origin sandbox on vxbe.space keeps the runtime isolated from the main Vibecodr app."
- text: Dedicated sandbox
- iframe [active]
- button "Restart vibe"
- button "Stop vibe"
- generic: Running

Iframe attributes were visible from the parent page:

{
  "count": 1,
  "attrs": {
    "title": "Vibe Runner",
    "class": "block w-full h-full border-0 bg-transparent h-full w-full border-0",
    "sandbox": "allow-scripts allow-forms allow-modals allow-pointer-lock allow-orientation-lock allow-presentation allow-same-origin",
    "allow": "fullscreen"
  }
}

What Failed

1. Browser Use could not enter the iframe DOM

frameLocator('iframe') and frameLocator('iframe[title="Vibe Runner"]') did not expose the iframe document/content:

{
  "htmlCount": 0,
  "rootCount": 0,
  "anyCount": 0,
  "buttons": 0
}

A scoped body lookup failed with:

Timed out after 3000ms waiting for selector iframe >> internal:control=enter-frame >> body: Browser Use encountered an error interacting with this webpage: Error: No element matched selector

2. Browser Use could not click into the visible iframe

Clicking the visible iframe itself failed before the click reached the app:

Unable to translate Input.dispatchMouseEvent in the in-app browser: Input targets inside cross-origin or inaccessible iframes are not currently supported in the in-app browser
waiting on click for selector iframe[title="Vibe Runner"]

3. Browser Use screenshots captured the Codex shell, not the browser page

Both screenshot APIs returned an image of the Codex desktop shell/sidebar rather than the visible in-app browser content:

await tab.cua.get_visible_screenshot()
await tab.playwright.screenshot({ fullPage: false })

This removed the normal visual fallback path. Even if DOM access is intentionally blocked by cross-origin iframe boundaries, a screenshot of the actual visible browser viewport plus coordinate clicks would have allowed the agent to proceed.

4. Browser Use page export command was unavailable

Trying the content export fallback failed with:

Unknown command: tab_content_export

Expected Behavior

For Browser Use in the Codex app, at least one of these should work reliably:

  1. Attach directly to the visible cross-origin iframe as the active Browser Use target without changing the user's current page.
  2. Forward coordinate clicks into visible iframe content from the parent page.
  3. Capture screenshots of the actual in-app browser viewport, including cross-origin iframe pixels, so visual reasoning and coordinate interaction can work.
  4. Provide a clear documented capability error and recovery path when cross-origin iframe interaction is unsupported.

Actual Behavior

Browser Use attached to the parent tab but could not inspect, screenshot, or interact with the meaningful app surface inside the iframe. Under a user requirement to preserve the current page and avoid direct iframe navigation/source inspection, the task became impossible through Browser Use.

Why this matters

This is a Codex/Browser Use issue because the failure is in the browser-control surface, not the website logic:

  • The parent page rendered and exposed the iframe.
  • The iframe was visible and active.
  • Browser Use explicitly reported that cross-origin/inaccessible iframe targets are not currently supported.
  • Screenshot capture did not capture the selected browser content, so Browser Use could not fall back to visual control.

The practical result is that agents fall back to scripts, source inspection, or direct runner URLs instead of using the built-in browser, which is exactly the behavior Browser Use is intended to avoid.

Suggested direction

A robust fix could be any of:

  • Add cross-origin iframe target selection/attachment for the in-app browser.
  • Add compositor-correct viewport screenshots for the actual selected browser pane.
  • Add coordinate mapping/click forwarding into visible iframe bounds, with appropriate safety gates.
  • Improve Browser Use diagnostics so the agent can tell the user immediately that the current visible iframe is not controllable and what action is needed.

Activity

  1. added
    bug
    app
    on May 5, 2026
  2. github-actions commented on May 5, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. theophanemayaud commented on Jun 11, 2026

    @theophanemayaud

    Same here, it's a bummer cuz some test logins I use depend on that. Back to being a button pusher so the agent can continue its work properly 🤦

  4. webtoots commented on Sep 17, 2026

    @webtoots

    Reproduced on Windows 10.0.26200.9445 with Codex Desktop 26.911.7940.0 and the in-app browser.

    Target: Microsoft Power Apps Studio 3.26091.9.381733538. The Studio UI is hosted in a cross-origin EmbeddedStudio iframe.

    Observed:

    • Browser Use attaches to the parent page successfully.
    • A Power Apps Studio tree item is resolved uniquely and reports count=1, visible=true, and enabled=true.
    • Normal click, coordinate click, and force: true click all fail with Click target is no longer available.
    • Manual clicking on the exact same visible item works.
    • Codex clicks on controls outside the iframe work.
    • Restarting Codex, reopening the Studio tab, creating a fresh in-app-browser session, and trying a fully visible tree item in the middle of the list do not help.
    • Direct navigation to the iframe URL cannot load Studio because it depends on its parent-host handshake.
    • This workflow worked previously, so this appears to be a regression.

    Impact:
    This blocks live Power Apps authoring and visual QA in Codex, even though Canvas Authoring MCP synchronization and compilation work. Manual intervention is required for every Studio navigation step.

    Please investigate recent changes to cross-origin iframe target lifetime and click forwarding in the in-app browser.

  5. sashalab commented on Oct 7, 2026

    @sashalab

    Additional reproduction on macOS, Codex Desktop 26.930.61225 (build 13232), in-app browser iab. This looks particularly close to the Power Apps report above: DOM/AX inspection finds the control, but clicking it fails with Click target is no longer available.

    The real-world case was an embedded ONLYOFFICE editor on a different subdomain of the same site. However, ONLYOFFICE is not required to reproduce this: a plain HTML button in a local iframe is sufficient.

    Narrowed reproduction

    Page structure IAB click result
    Top-level button Pass
    Same-origin iframe Pass
    Nested same-origin iframe Pass
    Cross-site iframe (127.0.0.1 parent → localhost child) Pass
    Cross-origin, same-site iframe (127.0.0.1 on two different ports) Fails: Click target is no longer available
    Same-site cross-origin case with Origin-Agent-Cluster: ?1 on the child origin Pass; targeted text input also passes

    The failing baseline still failed when retested after the successful header experiment. Both AX-based clicking and a frame-scoped Playwright locator exposed through Browser Use reproduced the failure.

    Diagnostic evidence

    Inspection of the installed browser-service.mjs points to the input guard resolving a child frame's node in the target root frame's isolated-world execution context (browser-use-input-guard), rather than the node's owning frame context.

    A read-only CDP experiment on the minimal local page confirmed the relevant distinction for the same child button backendNodeId:

    • DOM.resolveNode with the top frame's isolated-world executionContextId returned {type: "object", subtype: "null", value: null}.
    • The same call with the child frame's isolated-world executionContextId returned an HTMLButtonElement remote object.

    That is consistent with the guard reporting a missing/stale node even though the node still exists. A possible upstream fix is to make the guard's context selection frame-aware for same-process cross-origin frames, while retaining its existing input/shadow-root checks.

    The real editor also produced Keyboard focus root is no longer available for some operations. I have not isolated that keyboard symptom as completely: entering the local child frame with Tab and then typing worked. The reliable minimal failure here is clicking.

    Local workaround and limits

    Adding Origin-Agent-Cluster: ?1 only to the child origin made both click and targeted input work in a fresh local test tab. No Codex installation files were patched. This is a tested local workaround, not yet production validation for ONLYOFFICE and not a universal guarantee of separate browser processes. See Chromium's Origin-Agent-Cluster documentation.

    Self-contained reproduction

    Save the following as probe.py (Python standard library only). Use fresh, independent IAB tabs and different port pairs for the two runs:

    # Baseline, no isolation header:
    python3 probe.py --port 19066
    # Open http://127.0.0.1:19066/ in IAB.
    
    # Separate terminal: header only on the child origin:
    python3 probe.py --port 19166 --oac --oac-scope child
    # Open http://127.0.0.1:19166/ in a fresh IAB tab.

    Ask Browser Use to click Test button inside iframe#otherport. With the documented frame locator API, the action is:

    await tab.playwright
      .frameLocator('#otherport')
      .getByRole('button', { name: 'Test button', exact: true })
      .click();

    Expected: the button changes to Clicked. The baseline fails before the click reaches the button; the child-header variant works in the tested build.

    probe.py
    """Self-contained iframe input repro. Only loopback HTTP, no dependencies."""
    import argparse
    import threading
    from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
    
    parser = argparse.ArgumentParser()
    parser.add_argument('--port', type=int, default=18866)
    parser.add_argument('--oac', action='store_true')
    parser.add_argument('--oac-scope', choices=['all', 'child'], default='all')
    args = parser.parse_args()
    style = '<style>body{font:18px sans-serif;margin:24px}button,input{font:inherit;padding:8px;margin:8px}iframe{width:96%;height:200px;border:2px solid #777}</style>'
    control = '<button onclick="this.textContent=\'Clicked\'">Test button</button><label>Test input <input aria-label="Test input"></label>'
    
    class Handler(BaseHTTPRequestHandler):
        def do_GET(self):
            if self.path == '/':
                body = '<h1>Iframe input diagnostic</h1><h2>Top level</h2>' + control
                body += '<h2>Same origin</h2><iframe id="same" title="Same origin" src="/child"></iframe>'
                body += f'<h2>Same site, different origin</h2><iframe id="otherport" title="Same site different origin" src="http://127.0.0.1:{args.port+1}/child"></iframe>'
                body += f'<h2>Different site</h2><iframe id="cross" title="Different site" src="http://localhost:{args.port+1}/child"></iframe>'
            else:
                body = '<h1>Child frame</h1>' + control
            data = ('<!doctype html><meta charset="utf-8"><title>Iframe input diagnostic</title>' + style + body).encode()
            self.send_response(200)
            self.send_header('Content-Type', 'text/html; charset=utf-8')
            self.send_header('Content-Length', str(len(data)))
            self.send_header('Cache-Control','no-store')
            if args.oac and (args.oac_scope == 'all' or self.server.server_port == args.port + 1):
                self.send_header('Origin-Agent-Cluster', '?1')
            self.end_headers()
            self.wfile.write(data)
    
    servers = [ThreadingHTTPServer(('127.0.0.1', port), Handler) for port in (args.port, args.port+1)]
    threading.Thread(target=servers[1].serve_forever, daemon=True).start()
    print(f'Open http://127.0.0.1:{args.port}/ ; OAC={args.oac}', flush=True)
    try:
        servers[0].serve_forever()
    except KeyboardInterrupt:
        pass
    finally:
        for server in servers:
            server.server_close()

    Posting the additional evidence here rather than opening a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbrowserbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions