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 · 2 comments

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.

@fancy45daddy
Copy link
Author

fancy45daddy commented Nov 23, 2024

I already try not working. the website has some mechanism to check, if i open the close shadowroot the antibot mechanism will block me and not show me the real page.

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