[BUG] Chrome downloads fail despite `acceptDownloads` set
See original GitHub issueContext:
- Playwright Version: 0.13.0
- Operating System: macOS
- Extra:
node v13.12.0
Code Snippet
const playwright = require('playwright');
(async () => {
for (const browserType of ['chromium']) {
const browser = await playwright[browserType].launch();
// [RAW] NB: Ensure acceptDownloads is set per https://github.com/microsoft/playwright/blob/bb0b6cd90a9f95c2337ddfcafb516c48318e4c43/docs/api.md#class-download
const context = await browser.newContext({ acceptDownloads: true });
const page = await context.newPage();
page.on("download", (dl) => {
console.log("Captured download:", dl.url());
dl.path().then(console.log).catch(console.error);
});
await page.goto("https://upbeat-nightingale-6e32da.netlify.com/download");
await page.click("text=Download");
await page.waitFor(4_000);
await browser.close();
}
})();
Output:
$ node index.js
Captured download: https://upbeat-nightingale-6e32da.netlify.com/Archive.zip
Error: Pass { acceptDownloads: true } when you are creating your browser context.
at Download.path (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/download.js:41:19)
at Download.<anonymous> (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/helper.js:87:31)
at Page.<anonymous> (/Users/workspace/playwright-downloads/index.js:12:10)
at Page.emit (events.js:315:20)
at new Download (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/download.js:32:20)
at CRBrowser._downloadCreated (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/browser.js:37:26)
at FrameSession._onDownloadWillBegin (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/chromium/crPage.js:535:47)
at CRSession.<anonymous> (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/chromium/crPage.js:275:100)
at CRSession.emit (events.js:315:20)
at /Users/workspace/playwright-downloads/node_modules/playwright-core/lib/chromium/crConnection.js:137:47
-- ASYNC --
at Download.<anonymous> (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/helper.js:66:23)
at Page.<anonymous> (/Users/workspace/playwright-downloads/index.js:12:10)
at Page.emit (events.js:315:20)
at new Download (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/download.js:32:20)
at CRBrowser._downloadCreated (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/browser.js:37:26)
at FrameSession._onDownloadWillBegin (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/chromium/crPage.js:535:47)
at CRSession.<anonymous> (/Users/workspace/playwright-downloads/node_modules/playwright-core/lib/chromium/crPage.js:275:100)
at CRSession.emit (events.js:315:20)
at /Users/workspace/playwright-downloads/node_modules/playwright-core/lib/chromium/crConnection.js:137:47
at runNextTicks (internal/process/task_queues.js:62:5)
Describe the bug
Despite passing { acceptDownloads: true }
to the browser context (per the docs and error message), downloading fails complaining that acceptDownloads
is not set.
Expected Behavior: Archive.zip
is downloaded.
Misc.
Thanks for this amazing project! It’s awesome to see the rapid feature development and progress! 🎉
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Fix file download errors - Google Chrome Help
If you try to download a file and it doesn't work, first try to fix the error with these troubleshooting steps: Make sure...
Read more >[2023 Fix] Google Chrome Not Downloading Files - EaseUS
There are so many fixes for the 'Google Chrome is not downloading files' error can be found on the internet, but which one...
Read more >6 Ways to Fix the “Download Failed Network Error” on Chrome
Are you unable to complete downloads on Chrome? These solutions might fix your problem.
Read more >How to Fix “Download Failed: Network Error” on Chrome
Just download the installer for either browser, open it when it's set up, and then try downloading the file again. If that doesn't...
Read more >very large downloads fail with "Failed - Network Error" message
An extremely large (34 GB) CSV file fails to download in Chrome. ... Please feel free to open a new bug if this...
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 Free
Top 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
I am going to fiddle with this possible bug tomorrow and open a new issue if I find out it is a bug related to
Blobs
. I’ll make sure to include a reproducer.Wow thank you very much @rwoll for the in-depth debugging and quick fix, this fixed my issues with chromium but firefox is still unable to download
Blob
(but it is able to download files). I opened a separate issue for this (#1936 )