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
waitForSelector not working for iframe, unable to find element in iframe #2602
Comments
@aslushnikov cool stuff! it worked! thanks man |
Thanks @aslushnikov and @joevo2 you guys saved my day. Awesome stuff 👍 However, I am still unable to perform certain operations. |
Here's how I sorted it. async function recursiveFindInFrames(inputFrame, selector) {
const frames = inputFrame.childFrames();
const results = await Promise.all(
frames.map(async frame => {
const el = await frame.$(selector);
if (el) return el;
if (frame.childFrames().length > 0) {
return await recursiveFindInFrames(frame, selector);
}
return null;
})
);
return results.find(Boolean);
}
async function findInFrames(page, selector) {
const result = await recursiveFindInFrames(page.mainFrame(), selector);
if (!result) {
throw new Error(
`The selector \`${selector}\` could not be found in any child frames.`
);
}
return result;
}
const element = await findInFrames(page, '#element'); |
* fix: avoid waitForSelector with frames See puppeteer/puppeteer#2602 * feat: increase peerDependencies for puppeteer@^2.0.0 * feat: upgrade to puppeteer@2.0.0 * chore: build using Node.js 12 LTS LTS release October 21st https://nodejs.org/en/blog/release/v12.13.0/
This worked for me thanks a lot! |
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
Please include code that reproduces the issue.
unable to wait, temporary workaround of waitFor()
unable to find the button
What is the expected result?
Able to wait the iframe without
page.waitFor()
and press the next buttonWhat happens instead?
Unable to wait for the iframe, need to use
waitFor()
and unable to find the buttonTried the solution https://github.com/GoogleChrome/puppeteer/issues/1361
but not working.
Need help sincerely 😢
The text was updated successfully, but these errors were encountered: