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

Unable to get content of iframe inside shadow dom #4163

Closed
dmshkv opened this issue Mar 13, 2019 · 3 comments
Closed

Unable to get content of iframe inside shadow dom #4163

dmshkv opened this issue Mar 13, 2019 · 3 comments

Comments

@dmshkv
Copy link

dmshkv commented Mar 13, 2019

Hey, developers!
I'm trying to select elements of iframe, that is inside of shadow root of Polymer component, but no result. Have to mention that the page is the opened popup from the main app.

So I'm taking the popup's page like this and trying to iterate its

const pages = await browser.pages();
const popup = pages[pages.length - 1]; // last opened page, verified by url
const frames = popup.frames(); // this returns the wrong number of iframes inside the popup's page
frames.map(async (f) => {
    const itsUrl = await f.url();
    console.log(itsUrl);
}); // and there is no iframe from shadow root of polymer component

Also one of the used approaches

const pages = await browser.pages();
const popup = pages[pages.length - 1];
const shadowRoot = await page.evaluateHandle("document.querySelector('my-polymer-component').shadowRoot");
const some = await shadowRoot.$("body"); // this returns null

Can you please help in finding the proper solution for this?

@dmshkv
Copy link
Author

dmshkv commented Mar 14, 2019

Hey, @aslushnikov! Would you be so kind to take a look at the issue?

aslushnikov added a commit to aslushnikov/puppeteer that referenced this issue Mar 15, 2019
@aslushnikov
Copy link
Contributor

hey @dmshkv! Frames are reported just fine from-inside shadow DOM. One thing I can think of is that the page hasn't loaded yet, so the iframe is not inserted.

It's hard to say what's going on here for sure - since there's not enough information for me to reproduce this locally. I'd try waiting for the frameattached event.

If you don't see the frame reported by Puppeteer no matter what - than it's likely that you have an OOPIF and than this is a dupe of #2548.

@dmshkv
Copy link
Author

dmshkv commented Mar 15, 2019

Thanks, Andrey!

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