class Playwright::Download

“‘
download.save_as(“/path/to/save/at/” + download.suggested_filename)
# Wait for the download process to complete and save the downloaded file somewhere
download = download_info.value
page.get_by_text(“Download file”).click()
# Perform the action that initiates download
with page.expect_download() as download_info:
# Start waiting for the download
“`python sync
Download event is emitted once the download starts. Download path becomes available once download completes.
browser context is closed.
All the downloaded files belonging to the browser context are deleted when the
`Download` objects are dispatched by page via the [`event: Page.download`] event.

def cancel

Upon successful cancellations, `download.failure()` would resolve to `'canceled'`.
Cancels a download. Will not fail if the download is already finished or canceled.
def cancel
  wrap_impl(@impl.cancel)
end

def delete

Deletes the downloaded file. Will wait for the download to finish if necessary.
def delete
  wrap_impl(@impl.delete)
end

def failure

Returns download error if any. Will wait for the download to finish if necessary.
def failure
  wrap_impl(@impl.failure)
end

def page

Get the page that the download belongs to.
def page
  wrap_impl(@impl.page)
end

def path

to get suggested file name.
Note that the download's file name is a random GUID, use [`method: Download.suggestedFilename`]

Returns path to the downloaded file for a successful download, or throws for a failed/canceled download. The method will wait for the download to finish if necessary. The method throws when connected remotely.
def path
  wrap_impl(@impl.path)
end

def save_as(path)

```
download.save_as("/path/to/save/at/" + download.suggested_filename)
```python sync

**Usage**

is still in progress. Will wait for the download to finish if necessary.
Copy the download to a user-specified path. It is safe to call this method while the download
def save_as(path)
  wrap_impl(@impl.save_as(unwrap_impl(path)))
end

def suggested_filename

browsers can use different logic for computing it.
or the `download` attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
[`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header
Returns suggested filename for this download. It is typically computed by the browser from the
def suggested_filename
  wrap_impl(@impl.suggested_filename)
end

def url

Returns downloaded url.
def url
  wrap_impl(@impl.url)
end