waitForSelector not working for iframe, unable to find element in iframe
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.4.0
- Platform / OS version: macOS X 10.13.4
- URLs (if applicable): https://getvase.com
- Node.js version: v8.11.1
What steps will reproduce the problem?
Please include code that reproduces the issue.
describe('Main page', () => {
test(
'Initiate account kit signup',
async () => {
await page.goto('http://localhost:3000/')
// Click on phoneNumberView and enter number
await page.waitForSelector('.App-phone-number-input')
await page.click('input[type=tel]')
await page.type('input[type=tel]', myPhoneNumber)
await page.click('button[class=App-phone-go-button]')
// Wait for account kit iframe to load
await page.waitForSelector('iframe[src*=accountkit]')
await page.waitFor(3000)
const frame = await page
.frames()
.find(f => f.url().includes('accountkit'))
await frame.waitForSelector('button[class=_5xrj]')
const button = await frame.$('button[class=_5xrj]')
await button.click()
},
1600000
)
})
- Automated testing with Jest
- Input number then press submit
- Wait for account kit iframe
unable to wait, temporary workaround of waitFor()
- Press account kit iframe next button
unable to find the button
What is the expected result?
Able to wait the iframe without page.waitFor()
and press the next button
What happens instead?
Unable to wait for the iframe, need to use waitFor()
and unable to find the button
Tried the solution https://github.com/GoogleChrome/puppeteer/issues/1361 but not working.
Need help sincerely 😢
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to select elements within an iframe element in Puppeteer
You can get the iframe using contentFrame as you are doing now, and then call $ . const browser = await puppeteer.launch({ headless:...
Read more >puppeteer.Frame JavaScript and Node.js code examples
Closes browser with all the pages (if any were opened). Page.evaluate. Evaluates a function in the browser context. Page.click,; Page.waitForSelector,; Page.
Read more >Scraping iframes with Puppeteer - Help · Apify
How to get information from inside iframes using Puppeteer. ... of page objects like 'page.evaluate()', you are actually already working with frames.
Read more >Scraping iframes with Puppeteer - Agenty
Navigate to the page using page.goto() · Find the iframe by name() or url() · Wait for selector to ensure iframe loaded using...
Read more >Puppeteer documentation - DevDocs
There might be other frames created by iframe or frame tags. ... NOTE Extensions in Chrome / Chromium currently only work in non-headless...
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
@joevo2 can you try running browser with the following flag:
if it helps then this is due to #2548.
Thanks @aslushnikov and @joevo2 you guys saved my day. Awesome stuff 👍
However, I am still unable to perform certain operations. Like await frame.$eval(‘#selector’, element => element.textContent); works fine however, await frame.waitForSelector(‘#selector’,{visible: true}); times out for the same selector. Can you please help here.