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
Unable to intercept FileChooser when invoked from window.chooseFileSystemEntries #5210
Comments
Same issue. @agnivade did you develop any workaround for this? |
Nope, still waiting on the Chrome/puppeteer team to come back with something. |
@agnivade am I right thinking that waitForFileChooser does not work with Chromium 80+ at all? In my case it doesn't. But I did not see any errors. |
@DJ-Glock I try to downgrade Chromium version, and it works! |
Hey all, the original issue was about FileChooser not being intercepted if invoked from |
Bumping some important people again in the hope someone takes a look at this: @mathiasbynens @pavelfeldman @dmitshur |
Which version of puppeteer I should downgrade to if I want this working asap? |
@koresar as far as we know, |
@koresar fileChooser works fine for me with puppeteer 2.0.0 with HeadlessChrome/79.0.3945.0 (wich is part of puppeteer) |
Thank you people. Sound like I have an error of a different kind. Weird, but this code does networking, I think. const [fileChooser] = await Promise.all([
page.waitForFileChooser(),
page.click(".upload-indicator button") // some button that triggers file selection
]);
await fileChooser.accept([`${__dirname}/file.txt`]); But I need, well, to just choose a file. |
@koresar what error do you get finally? What is the puppeteer / chromium version? |
I'm getting
somewhere within JSHandle.js. I assume it tries to upload file. However, the Angular app I'm trying to automate with puppeteer does not do that. |
Ok. Here is my bug. |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
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! |
This issue still exist and the only fix to this is downgrading to 4 years old chrome ver 78. Please re-open and start investigation to solve |
Same problem for me. |
Running into the same problem....:/ |
same here :( |
This is both an issue with puppeteer and Chromium. I am raising an issue here in the hope that it gets more eyes than in the Chromium issue tracker.
Steps to reproduce
Tell us about your environment:
Basically, I am calling
window.chooseFileSystemEntries
which is a new functionality introduced in Chrome 78 to access the native filesystem. (https://web.dev/native-file-system/). And then I want to intercept the opening of the file dialog, and pass a file path to it.Unfortunately, the event does not get intercepted. Whereas, it clearly does, when I manually invoke a file opener dialog from an
input[type="file"]
.I think since this is a bleeding edge feature, perhaps this follows a different code path from inside Chrome, due to which the event handler is unable to intercept it.
What steps will reproduce the problem?
Please include code that reproduces the issue.
HTML file:
Serve this HTML file using any local web server.
JS Code
What is the expected result?
There are couple of issues here.
When I click
#openFile
, the filechooser dialog does not get intercepted at all. I can see the dialog, and after 30 secs, it times out with:But if I change it to click
#open2
, everything works perfectly fine. AndfileChooser
gets logged properly.This is a problem with Chromium.
The
page.handleFileChooser
API is removed from Chromium 80 at chromium/chromium@41361e4. So therefore, usingfileChooser.accept
with Chromium 80 raises an error. This is something to be fixed at puppeteer. The API needs to use the new fields at https://chromedevtools.github.io/devtools-protocol/tot/Page#event-fileChooserOpened to call the https://chromedevtools.github.io/devtools-protocol/tot/DOM#method-setFileInputFiles method.The commit also moved the dialog interception from browser-side to blink-side. I hoped that it will make a difference in intercepting dialogs invoked from
window.chooseFileSystemEntries
but it does not. The same failure to interception occurs with Chrome 78 too./cc @pavelfeldman who made the commit.
For further context: I work on WebAssembly with the Go team. Not being able to read/write files has prevented us from running the Go test suite inside the browser, which has failed to catch several bugs. Currently, we run tests inside Node. But resolving this issue will allow us to run the test suite inside the browser too.
The text was updated successfully, but these errors were encountered: