java.lang.Object
net.serenitybdd.screenplay.playwright.questions.DownloadedFile

public class DownloadedFile extends Object
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 Type
    Method
    Description
    static net.serenitybdd.screenplay.Question<com.microsoft.playwright.Download>
    Get the Download object for advanced operations.
    static net.serenitybdd.screenplay.Question<String>
    Get the failure reason if the download failed, or null if successful.
    static net.serenitybdd.screenplay.Question<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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • suggestedFilename

      public static net.serenitybdd.screenplay.Question<String> suggestedFilename()
      Get the suggested filename from the Content-Disposition header or URL.
    • url

      public static net.serenitybdd.screenplay.Question<String> url()
      Get the URL that initiated the download.
    • path

      public static net.serenitybdd.screenplay.Question<Path> path()
      Get the path to the downloaded file. Note: This is the temporary path; use WaitForDownload.andSaveTo() to save permanently.
    • failure

      public static net.serenitybdd.screenplay.Question<String> 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.