Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs(download): improve documentation (#6486)

Sébastien Règne33823a91433e
diff --git a/docs/src/api/class-download.md b/docs/src/api/class-download.md
index b1e6fd8196..e5de7a7313 100644
--- a/docs/src/api/class-download.md
+++ b/docs/src/api/class-download.md
@@ -2,8 +2,8 @@
[Download] objects are dispatched by page via the [`event: Page.download`] event.
-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.
+If `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the
+browser context is closed. And all downloaded files are deleted when the browser closes.
Download event is emitted once the download starts. Download path becomes available once download completes:
@@ -77,13 +77,13 @@ wait for the download to finish if necessary. The method throws when connected r
## async method: Download.saveAs
-Saves the download to a user-specified path. It is safe to call this method while the download
-is still in progress.
+Copy the download to a user-specified path. It is safe to call this method while the download
+is still in progress. Will wait for the download to finish if necessary.
### param: Download.saveAs.path
- `path` <[path]>
-Path where the download should be saved.
+Path where the download should be copied.
## method: Download.suggestedFilename
- returns: <[string]>
diff --git a/types/types.d.ts b/types/types.d.ts
index c983bfdc61..d021a7975c 100644
--- a/types/types.d.ts
+++ b/types/types.d.ts
@@ -9264,8 +9264,8 @@ export interface Dialog {
* [Download] objects are dispatched by page via the
* [page.on('download')](https://playwright.dev/docs/api/class-page#pageondownload) event.
*
- * 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.
+ * If `downloadsPath` isn't specified, all the downloaded files belonging to the browser context are deleted when the
+ * browser context is closed. And all downloaded files are deleted when the browser closes.
*
* Download event is emitted once the download starts. Download path becomes available once download completes:
*
@@ -9305,8 +9305,9 @@ export interface Download {
path(): Promise<null|string>;
/**
- * Saves the download to a user-specified path. It is safe to call this method while the download is still in progress.
- * @param path Path where the download should be saved.
+ * Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will
+ * wait for the download to finish if necessary.
+ * @param path Path where the download should be copied.
*/
saveAs(path: string): Promise<void>;