Skip to content

Commit 2910d5e

Browse files
authored
docs(api): add Python expect_download usage (#41619)
1 parent b381185 commit 2910d5e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

docs/src/api/class-page.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4648,6 +4648,24 @@ Will throw an error if the page is closed before the download event is fired.
46484648
* langs: python
46494649
- returns: <[EventContextManager]<[Download]>>
46504650

4651+
**Usage**
4652+
4653+
```python async
4654+
async with page.expect_download() as download_info:
4655+
await page.get_by_text("Download").click()
4656+
4657+
download = await download_info.value
4658+
print(download.url)
4659+
```
4660+
4661+
```python sync
4662+
with page.expect_download() as download_info:
4663+
page.get_by_text("Download").click()
4664+
4665+
download = download_info.value
4666+
print(download.url)
4667+
```
4668+
46514669
### param: Page.waitForDownload.action = %%-csharp-wait-for-event-action-%%
46524670
* since: v1.12
46534671

0 commit comments

Comments
 (0)