Closed niranjan94 closed 2 years ago
Context:
1.22.0
v16.13.0
Code Snippet
import { chromium } from 'playwright'; async function main() { const browser = await chromium.launch({ headless: false, }); const context = await browser.newContext({}); const page = await context.newPage(); page.on('filechooser', (fileChooser) => { console.log('file chooser has been triggered'); fileChooser.setFiles([]); }); await page.goto('https://output.jsbin.com/nugolebuce'); await page .frameLocator('iframe') .frameLocator('#result') .locator('body > div > input[type=file]') .click(); } main();
Describe the bug
filechooser
As a workaround, I'm able to make it work by setFileChooserInterceptedNoReply on the private channel on any frame navigation within the page.
setFileChooserInterceptedNoReply
page.on('framenavigated', async (frame) => { frame.page()._channel.setFileChooserInterceptedNoReply({ intercepted: true }); });
Thanks @yury-s for the quick fix :)
Sir, @yury-s , is there any way to choose a single folder with playwright when clicking on a div/button?
Context:
1.22.0
v16.13.0
Code Snippet
Describe the bug
filechooser
chooser event does not work if the file input is within an iframe. The file chooser dialog is not intercepted as it should be.As a workaround, I'm able to make it work by
setFileChooserInterceptedNoReply
on the private channel on any frame navigation within the page.