Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs(api.md): clarify downloads lifetime (#1698)
Andrey Lushnikovd21e2c9b460e
diff --git a/docs/api.md b/docs/api.mdindex 899baa71e4..621e7088cf 100644--- a/docs/api.md+++ b/docs/api.md@@ -738,7 +738,9 @@ Emitted when the JavaScript [`DOMContentLoaded`](https://developer.mozilla.org/e#### event: 'download'- <[Download]>-Emitted when attachment is downloaded. User can access basic file operations on downloaded content via the passed [Download] instance. Browser context must be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.+Emitted when attachment download started. User can access basic file operations on downloaded content via the passed [Download] instance.++> **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.#### event: 'filechooser'- <[Object]>@@ -2994,20 +2996,23 @@ const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.[Download] objects are dispatched by page via the ['download'](#event-download) event.-Note that browser context must be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.-All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded files are deleted when the browser closes.-An example of using `Download` class:+Download event is emitted once the download starts. Download path becomes available+once download completes:+```jsconst [ download ] = await Promise.all([- page.waitForEvent('download'),+ page.waitForEvent('download'), // wait for download to startpage.click('a')]);+// wait for download to completeconst path = await download.path();...```+> **NOTE** Browser context **must** be created with the `acceptDownloads` set to `true` when user needs access to the downloaded content. If `acceptDownloads` is not set or set to `false`, download events are emitted, but the actual download is not performed and user has no access to the downloaded files.+<!-- GEN:toc -->- [download.createReadStream()](#downloadcreatereadstream)- [download.delete()](#downloaddelete)