Free tools Windows power users keep installed
One-click scans. No signup required.
To capture a blob-backed file with Playwright, start waiting for the browser’s download event before clicking the control, then save the returned Download object. This works when the page’s action actually starts an attachment download; a URL beginning with blob: does not, by itself, guarantee that Playwright will emit that event.
Capture the download in JavaScript or TypeScript
Register the event waiter before triggering the action. If you click first, a fast download could begin before Playwright is listening.
As an Amazon Associate I earn from qualifying purchases.
const downloadPromise = page.waitForEvent('download');
await page.getByRole('button', { name: /download/i }).click();
const download = await downloadPromise;
await download.saveAs(`/tmp/${download.suggestedFilename()}`);
Replace the button locator and destination path for your application and test environment. The Playwright Download object provides the suggested filename and file operations; explicitly save the file to a stable location before the browser context closes. See Playwright’s download documentation.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Capture the download in Python
In Python, place the action inside page.expect_download(), then save the resulting download:
#1 Best Overall
async with page.expect_download() as download_info:
await page.get_by_role("button", name="Download").click()
download = await download_info.value
await download.save_as(f"/tmp/{download.suggested_filename}")
This example uses Playwright’s asynchronous Python API. With the synchronous API, use the same context-manager pattern without async and await. Keep the save path appropriate for your operating system and test runner.
Understand what a blob URL means
A blob: URL is an opaque browser-managed reference to data, often created from a Blob with URL.createObjectURL(). It is not a normal network URL to reconstruct or fetch by hand. A page can navigate to a blob URL or use it as a download link. The HTML anchor download attribute can mark blob: and data: URLs for downloading, but the attribute suggests a filename rather than guaranteeing identical handling in every browser. See MDN’s blob URL reference and MDN’s anchor download documentation.
Rank #2
Playwright documents its download event for attachment downloads. Its documentation does not establish that every blob creation, click, navigation, or browser setting produces that event. Test the exact app flow in the browsers you support; do not infer successful event capture merely from seeing a blob URL.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Blob URL lifetime matters
Applications create and release object URLs with URL.createObjectURL() and URL.revokeObjectURL(). Revoking too early can make the URL unusable before the browser consumes it. When debugging, check the application’s timing rather than immediately adding a second click or retry that could hide a lifecycle bug.
Choose the right event scope
For a known button on a known page, a Page-level waiter such as page.waitForEvent('download') or Python’s page.expect_download() is the clearest choice. If downloads may originate on multiple pages in the same browser context, a BrowserContext-level download event can observe them across pages; Playwright marks that context event as added in v1.60. See the Page download event and BrowserContext download event references.
For an unknown trigger, a Page listener can help identify where the event occurs:
Rank #4
page.on('download', async download => {
await download.saveAs(`/tmp/${download.suggestedFilename()}`);
});
Event-handler work is asynchronous. Make sure the test waits for work started by the handler so it cannot outlive the test. Prefer an explicit waiter around a known action when possible; it makes the expected event and action easier to correlate.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Persist and verify the file
Playwright stores downloads in a temporary location associated with the producing browser context. Those files are deleted when the context closes, so save the download before closing that context. The suggested filename is typically derived from the response’s Content-Disposition header or the HTML download attribute, and browser behavior can vary. If the filename matters, assert it instead of assuming it.
- Check that the destination file exists after saving.
- Assert the expected filename or extension when those are part of the test contract.
- Check that the file is nonempty or has an expected size range if appropriate.
- For PDFs or other structured documents, validate the contents or parseability rather than treating a successful event as proof the right document was captured.
Troubleshoot missing or incorrect downloads
| Symptom | Likely cause | What to check |
|---|---|---|
| No download event arrives | The waiter was installed after the action, the locator missed the real trigger, or the page navigated/opened a blob resource instead of starting an attachment download. | Install the waiter before clicking; verify the actual control and inspect whether the page created an anchor with a blob URL and a download attribute or followed a different navigation path. |
| The download event occurs, but the file disappears | The file remained in the browser context’s temporary download storage and the context closed. | Call saveAs or save_as to copy it to a stable path before closing the context. |
| The saved file has an unexpected name | The browser may choose a name based on Content-Disposition, the anchor’s download value, or browser-specific handling. |
Inspect the application’s link/response behavior and assert the filename your supported browser actually provides. |
| The blob link stops working | The application may revoke its object URL before the browser has consumed it. | Review when URL.revokeObjectURL() runs relative to the click and browser download action. |
| A listener starts saving but the test ends early | Listener work may run separately from the main test flow. | Await the save operation or use a waiter that returns the download directly, then save it in the test’s main flow. |
Or skip the browser setup
If you need a screenshot of the page that presents the download control—not the blob file itself—ScreenshotNeo can return a website screenshot or PDF from one GET request. It does not capture a browser-managed blob download as a Playwright Download object.
For example, request a screenshot of the relevant page:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners, popups and chat widgets are removed before the shot; bot checks, blank pages and failed loads are never billed. An MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000. Sign up for the free plan.
Recommended Free Tools
Frequently Asked Questions
Can Playwright download a file directly from a blob URL?
It can capture the download when the application’s browser interaction starts a download event. Seeing a blob URL alone does not prove that an event will fire; test the actual flow.
Should I save the download before closing the browser context?
Yes. Playwright’s context-owned temporary downloads are removed when the producing context closes, so copy needed files to a stable path first.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




