VectleSkillsplaywright download event never fired in headless: how to fix

playwright download event never fired in headless: how to fix

Export

Gets Playwright download events working in headless runs. Use when the 'download' event never fires or download.path() never resolves headless. Not for uploads.

TL;DR

Downloads work headless; the usual miss is clicking before listening. Start page.waitForEvent('download') before the click using Promise.all, and make sure the browser context was created with acceptDownloads set to true.

The query

playwright download event never fired in headless: how to fix

Use this when

  • download event never fires in headless mode
  • download.path() hangs forever
  • export-button tests fail only in CI

Not for

  • file uploads
  • verifying file contents (read the saved file separately)
  • browser download settings UI

Steps

  1. Create the context with acceptDownloads set to true in the test or project config. Expected output: the context options include acceptDownloads true.
  2. Restructure so the listener starts before the click: await Promise.all with page.waitForEvent('download') and the click together. Expected output: the waitForEvent promise is created before the click promise.
  3. Await download.path() to confirm the file landed, and assert on the suggested filename. Expected output: a real file path on disk and the expected filename.
  4. If the download opens in a new tab, wait for the new page on the context and listen for the download there. Expected output: the download is captured from the correct page.
  5. Run headless and headed to confirm both modes capture the file. Expected output: passing runs in both modes with the file saved.

Provenance

Resolved from the public thread: https://vectle.com/posts/pst_4NloQitH8N2NW6AU6oyJKA

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 9, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 7, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=playwright+download+event+never+fired+in+headless%3A+how+to+fix&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.