Can't retrieve IFrame in {headless: false} mode
See original GitHub issueSteps to reproduce
- Take prepared repository https://github.com/pahan35/puppeteer-stripe-iframe-detection-bug
- Install packages
npm i
- Run
npm start
Tell us about your environment:
- Puppeteer version: 1.20.0
- Platform / OS version: MacOS Mojave 10.14.6
- URLs (if applicable): https://stripe-payments-demo.appspot.com
- Node.js version: 12.10.0
What steps will reproduce the problem?
const puppeteer = require('puppeteer')
const {Events} = require('puppeteer/lib/Events')
;(async () => {
const browser = await puppeteer.launch({
headless: false,
})
const page = await browser.newPage()
const waitForFrame = async name => {
const frames = new Set()
return new Promise((resolve, reject) => {
const wait = setTimeout(() => {
reject(
Error(
`Timeout while waiting for frame "${name}", have: ${JSON.stringify(
[...frames],
)}`,
),
)
}, 10000)
function checkFrame() {
const frame = page.frames().find(f => {
const fname = f.name()
frames.add(fname)
return fname.includes(name)
})
if (frame) {
clearTimeout(wait)
resolve(frame)
} else {
page.once(Events.Page.FrameNavigated, checkFrame)
}
}
checkFrame()
})
}
await page.goto('https://stripe-payments-demo.appspot.com')
try {
const stripeFrame = await waitForFrame('privateStripeFrame')
await stripeFrame.waitFor('body')
console.log('Body found successfully')
} catch (e) {
console.error(e)
}
process.exit()
})()
- Just run code above
What is the expected result?
I expect to see Body found successfully
from script, as it works in headless: true
mode
What happens instead? Puppeteer fails on retrieving iframe
Extra info is described in README.MD of the linked repo
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Why Iframe is not loading properly in Headless mode of ...
This is because of the React iframe not supported in Electron browser. Set the chrome browser using command --browser chrome in package.json ...
Read more >Object iframe is not present on Headless Chrome, please help
I think your best bet is to create a new test case that gets executed exclusively in headless mode. You'd have to re-base...
Read more >Issue 2198: ChromeDriver 2.34 doesn't wait until iframe ...
trying to click on any element in the Iframe will fail. trying to wait for any element will fail. trying to get the...
Read more >How To Handle iFrames In Cypress | Cypress Advanced Tutorial
... How To Run Cypress Tests In Headless Mode : https://bit.ly/3AB03e6 *Useful Blogs & Docs* ♢ Getting Started With Cypress ...
Read more >Getting to Know Puppeteer Using Practical Examples
Because of the fact that the browser is launched in headless mode by default, ... const browser = await puppeteer.launch({ headless: false, ...
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 FreeTop 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
Top GitHub Comments
pahah, check out https://github.com/GoogleChrome/puppeteer/issues/4960
That should work in the latest version, I believe. Please open a new issue if it still reproduces.