Download file (FR)
Perfecto Command
perfecto:file:download
Purpose
For Web tests, provides a link to files on the remote machine on which the test ran.
If a test includes files, you can use this command to receive a link to access the remote repository where the files were saved during the test. From there, you can download the exact file or files to your local machine. You can use this command in combination with the file list and file info commands.
Parameters
Name | Type | Possible Values | Description |
---|---|---|---|
filename | String |
|
The name of the file on the remote machine. Example: To view the device file system, log in to the Perfecto Lab interface and use the file transfer widget. |
Return Value
String
Exceptions
If the file does not exist, the following exception is thrown: File not found - No such file
Example
Java sample
//get a link to download the file
String filename = "annual-report-2019.pdf";
Map<String, Object> params = new HashMap<>();
params.put("filename", filename);
String link = (String) driver.executeScript("perfecto:file:download", params);
System.out.println(link);
//download the file
FileUtils.copyURLToFile(new URL(link), new File("C:\\Download\\annual-report-2019.pdf"), 10000, 10000);