-
Notifications
You must be signed in to change notification settings - Fork 9k
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
uploadFile uploads empty file #5499
Comments
Something is not right with uploadFile in the newest puppeteer version. I actually just thought that I am using version 1.20.0 , but it was the newest version, when I reverted to v 1.20.0 same code works fine without even calling trigger('change') on the file input field. Due to lack of time to finish this project, I cannot test in which version this functionality breaks, but I will try it out when I will have more time. |
I have the same problem of an empty file being uploaded to a website. I also get a response from the page saying "TypeError: t.map is not a function". I have already tried the latest version and version 1.20.0. Always the same message. |
I have found a working solution for me. Puppeteer version 2.0.0 Try it: FileChooser |
@GreedyY0 I can confirm that 2.0.0 is the only version if you want to use uploadFile. In 2.1.1, uploadFile is broken again. |
Should be fixed by : #5358 |
This should be fixed by 532ae57 as we've moved back to |
I have the same problem. And I fix it by the way that some function is monitoring the uploadfile button. It means when I try to click upload file using puppeteer, but my function is not be triggered. |
What steps will reproduce the problem?
In that page there is a form in a popup with photo upload:
When you click Add files it opens file dialog, and then when you select a file it shows this preview:
But when Im using pupeteer to upload file, I get this:
It shows correct filename and correct file size, but preview is empty image and when I try to "Start Upload", it shows that Im trying to upload an empty file.
My code looks like this:
I tried multiple files, different extensions, tried with absolute/relative path, same result. I also noticed strange thing, I used to upload photos in mercari.com (also uses dropzone) and it used to respond to input file changes by just using uploadFile, but here, without this line:
await page.evaluate(() => $('.btn-add-photo input[type="file"]').trigger('change'));
It does not seem to work at all. VIew just stays like this, like no file was selected at all:
The text was updated successfully, but these errors were encountered: