question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Chrome downloads fail despite `acceptDownloads` set

See original GitHub issue

Context:

  • 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
SeekDaSkycommented, Apr 22, 2020

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.

0reactions
SeekDaSkycommented, Apr 23, 2020

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 )

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found