chrome-devtools-mcp icon indicating copy to clipboard operation
chrome-devtools-mcp copied to clipboard

Cross-Origin IFrame Support / Frame Selection / Target.setAutoAttach

Open michiglueck opened this issue 3 weeks ago • 3 comments

Is your feature request related to a problem? Please describe.

The documentation does not explicitly mention support for frame selection, cross-origin iframe access, or Target.setAutoAttach functionality which would be needed to attach to OOPIF (Out-of-Process Iframe) targets.

These capabilities are not described in the provided materials, so either I didn't find where they are listed or are not yet supported. Therefore I am requesting frame selection support

It would be super useful though for automated/semi-automated iterative AI Agent Testing and really speed up some workflows, if it's not necessary to find workarounds. Thank you!

Describe the solution you'd like

  1. Feature Request for chrome-devtools-mcp (Long-term)

The CDP protocol does support accessing cross-origin iframes via https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-setAutoAttach with flatten: true. This allows attaching to iframe targets and getting their own session IDs.

Describe alternatives you've considered

Programmatic API (Best for E2E testing)

Additional context

No response

michiglueck avatar Dec 22 '25 09:12 michiglueck

Thanks for reporting but chrome-devtools-mcp supports cross-origin iframes as it is based on Puppeteer. E.g., you can expect the content from the iframes to be included into the snapshots. Is there any specific scenario that does not work?

OrKoN avatar Jan 07 '26 14:01 OrKoN

thanks for the response. I did some testing and it doesn't seem to work in this case. The cross-origin iframe appears as an empty IframePresentational node.

Setup: locally hosted: e.g. Parent page: https://procmod.test:3000 OpenAI ChatKit web component: with Shadow DOM (mode: "open") Cross-origin iframe inside Shadow DOM: https://cdn.platform.openai.com/deployments/chatkit/..

Snapshot result: uid=4_422 IframePresentational No children - the iframe content is not accessible.

Additional observations:

  • list_pages returns only 1 page (no separate OOPIF target for the iframe)
  • Clicking IframePresentational works but doesn't expose iframe content, no chat message can be sent
  • Screenshot confirms ChatKit is visually loaded and functional

Question: Is there something specific we need to do to enable OOPIF support? like for example:

  • A configuration option to enable Target.setAutoAttach with flatten: true?
  • A way to explicitly attach to cross-origin iframe targets?

Would be super helpful for E2E Testing! Thank you!

michiglueck avatar Jan 07 '26 18:01 michiglueck

This might be unrelated to the OOPIF support. The snapshot only returns accessible page elements unless queried with verbose=true. Presentational content is usually omitted. Here is an example of the snapshot returning content of an OOPIF at https://mathiasbynens.github.io/css-dbg-stories/iframe-navigations.html

Image

I believe to see the content you might need to change ARIA attributes on the iframe to make sure it is accessible. Could you provide a test page for your scenario?

OrKoN avatar Jan 08 '26 09:01 OrKoN

Thank you, you were right!

The ChatKit iframe has role="presentation" set by OpenAI's web component:

// ChatKit iframe attributes: { "role": "presentation", // ← This causes IframePresentational "class": "ck-iframe", "src": "https://cdn.platform.openai.com/...", ... }

This is why it shows as IframePresentational with no children - the accessibility tree correctly treats it as decorative content.

  • Your example: uid=2_7 Iframe (with children)
  • Our ChatKit: uid=4_422 IframePresentational (no children)

The ChatKit iframe has role="presentation" which tells the accessibility tree to treat it as presentational/decorative content. This is why it shows up a IframePresentational with no children - OpenAI explicitly marked it as presentational.

So unfortunately I probably cannot solve this in the App myself either, but it's not a gap in the MCP Tools

michiglueck avatar Jan 08 '26 17:01 michiglueck