mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs: remove api ref and improve text (#17099)
This commit is contained in:
parent
da1598d45f
commit
d7e45c44de
@ -3,13 +3,9 @@ id: downloads
|
|||||||
title: "Downloads"
|
title: "Downloads"
|
||||||
---
|
---
|
||||||
|
|
||||||
:::note
|
|
||||||
For uploading files, see the [uploading files](./input.md#upload-files) section.
|
|
||||||
:::
|
|
||||||
|
|
||||||
For every attachment downloaded by the page, [`event: Page.download`] event is emitted. All these attachments are going
|
|
||||||
to be downloaded into a temporary folder. You can obtain the download url, file system path and payload stream using
|
For every attachment downloaded by the page, [`event: Page.download`] event is emitted. All these attachments are downloaded into a temporary folder. You can obtain the download url, file system path and payload stream using the [Download] object from the event.
|
||||||
the [Download] object from the event.
|
|
||||||
|
|
||||||
You can specify where to persist downloaded files using the [`option: downloadsPath`] option in [`method: BrowserType.launch`].
|
You can specify where to persist downloaded files using the [`option: downloadsPath`] option in [`method: BrowserType.launch`].
|
||||||
|
|
||||||
@ -107,9 +103,8 @@ page.on("download", lambda download: print(download.path()))
|
|||||||
page.Download += (sender, download) => Console.WriteLine(download.Url);
|
page.Download += (sender, download) => Console.WriteLine(download.Url);
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that handling the event forks the control flow and makes script harder to follow. Your scenario might end while you
|
Note that handling the event forks the control flow and makes the script harder to follow. Your scenario might end while you are downloading a file since your main control flow is not awaiting for this operation to resolve.
|
||||||
are downloading a file since your main control flow is not awaiting for this operation to resolve.
|
|
||||||
|
|
||||||
### API reference
|
:::note
|
||||||
- [Download]
|
For uploading files, see the [uploading files](./input.md#upload-files) section.
|
||||||
- [`event: Page.download`]
|
:::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user