Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: I want to know how to click the cors iframe in close shadow root #33725

Open
fancy45daddy opened this issue Nov 22, 2024 · 1 comment

Comments

@fancy45daddy
Copy link

🚀 Feature Request

I see playwright can click the element in iframe with different domain. But now the iframe is inside the close shadow root. I can not use playwright to click the iframe. I have to write an chrome extension content script to access the close shadow root like:

(async () =>
{
    await new globalThis.Promise(_ => globalThis.setTimeout(_, 1000 * 60))
    const shadowRoot = chrome.dom.openOrClosedShadowRoot(document.querySelector('div[style*="display: grid;"] > div > div'))
    const iframe = chrome.dom.openOrClosedShadowRoot(shadowRoot.querySelector('iframe').contentDocument.body)
    iframe.querySelector('input').click()
})()

But querySelector('iframe').contentDocument will return null due to different domain. I want to know how playwright access the dom of iframe with different domain. So I can use it in my case.

Use javascript? Use chrome extension? or any devtools?

Example

No response

Motivation

N/A

@dgozman
Copy link
Contributor

dgozman commented Nov 22, 2024

@fancy45daddy See #23047 for a workaround that turns all closed shadow roots into open shadow roots. Let me know whether this helps.

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

No branches or pull requests

2 participants