Class DownloadedFile
java.lang.Object
net.serenitybdd.screenplay.playwright.questions.DownloadedFile
Query information about the most recently downloaded file.
This question is used after a WaitForDownload interaction
to retrieve details about the downloaded file.
Sample usage:
// First, perform the download
actor.attemptsTo(
WaitForDownload.whilePerforming(Click.on("#download-btn"))
);
// Then query the download details
String filename = actor.asksFor(DownloadedFile.suggestedFilename());
String url = actor.asksFor(DownloadedFile.url());
Path path = actor.asksFor(DownloadedFile.path());
// Check if download failed
String error = actor.asksFor(DownloadedFile.failure());
if (error == null) {
// Download succeeded
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.serenitybdd.screenplay.Question<com.microsoft.playwright.Download>download()Get the Download object for advanced operations.static net.serenitybdd.screenplay.Question<String>failure()Get the failure reason if the download failed, or null if successful.static net.serenitybdd.screenplay.Question<Path>path()Get the path to the downloaded file.static net.serenitybdd.screenplay.Question<String>Get the suggested filename from the Content-Disposition header or URL.static net.serenitybdd.screenplay.Question<String>url()Get the URL that initiated the download.
-
Method Details
-
suggestedFilename
Get the suggested filename from the Content-Disposition header or URL. -
url
Get the URL that initiated the download. -
path
Get the path to the downloaded file. Note: This is the temporary path; use WaitForDownload.andSaveTo() to save permanently. -
failure
Get the failure reason if the download failed, or null if successful. -
download
public static net.serenitybdd.screenplay.Question<com.microsoft.playwright.Download> download()Get the Download object for advanced operations.
-