Skip to content

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

docs(api): add Python expect_download usage (#41619)

Pravin Ireri2910d5eeeb33
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index 3f0febb599..7cf23b7663 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -4648,6 +4648,24 @@ Will throw an error if the page is closed before the download event is fired.
* langs: python
- returns: <[EventContextManager]<[Download]>>
+**Usage**
+
+```python async
+async with page.expect_download() as download_info:
+ await page.get_by_text("Download").click()
+
+download = await download_info.value
+print(download.url)
+```
+
+```python sync
+with page.expect_download() as download_info:
+ page.get_by_text("Download").click()
+
+download = download_info.value
+print(download.url)
+```
+
### param: Page.waitForDownload.action = %%-csharp-wait-for-event-action-%%
* since: v1.12