Download
Playwright\Download\DownloadInterface
DownloadInterface for Playwright PHP.
Methods
cancel()
voidCancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations, download.failure() would resolve to 'canceled'.
function cancel(): void
createReadStream()
Returns a readable stream for a successful download, or null if the transport does not provide it.
function createReadStream()
delete()
voidDeletes the downloaded file. Will wait for the download to finish if necessary.
function delete(): void
failure()
?stringReturns download error if any. Will wait for the download to finish if necessary.
function failure(): ?string
page()
PageInterfaceGet the page that the download belongs to.
function page(): PageInterface
path()
?stringReturns 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.
function path(): ?string
saveAs()
voidCopy 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.
function saveAs(string $path): void
suggestedFilename()
stringReturns suggested filename for this download. It is typically computed by the browser from the Content-Disposition response header or the download attribute.
function suggestedFilename(): string
url()
stringfunction url(): string