Unable to get all iframes in the page
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 3.3.0
- Platform / OS version: 10.15.5
- URLs (if applicable): https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
- Node.js version: 12.16.1
What steps will reproduce the problem?
const puppeteer = require("puppeteer");
const url = `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe`;
(async () => {
const browser = await puppeteer.launch({
headless: false,
defaultViewport: null,
});
const page = await browser.newPage();
await page.goto(url);
await new Promise((resolve) => setTimeout(resolve, 5000));
const frames = await page.frames();
console.log("frames", frames.length);
})();
- Run the code
- Logs
What is the expected result?
- 3 total frames. Page has two iframes in the page that you can see by using page’s devtools and running
document.getElementsByTagName('iframe')
What happens instead?
- We get just one frame which is the top frame/page.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How do I get all iframe elements? - Stack Overflow
First, <script> tags should go either in the <head> or the <body> but not in between! I would change your naming scheme slightly...
Read more >How To Get an Element in an iframe - W3Schools
Click the button to hide the first H1 element in the iframe (another document). Hide H1 Element. Get Element in Iframe. Get the...
Read more >How to handle iFrame in Selenium - BrowserStack
It is possible to identify the iframes on a web page in two ways: Right-click on the specific element and check all the...
Read more >The ultimate guide to iframes - LogRocket Blog
Not a fan of iframes? This post provides an overview of the tag's best features, shows you how to use them, and how...
Read more >Scraping iframes with Puppeteer - Help · Apify
How to get information from inside iframes using Puppeteer. ... For all references about page and frame objects (and Puppeteer generally), you should...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

have a look thru #5123 there’s a resolution . I tried and it works
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!