My page has a link that on clicking will download a file. I just need to check if the file has been downloaded and of the correct extension.
Asked
Active
Viewed 1.0k times
3

dertkw
- 7,798
- 5
- 37
- 45

Roopali Bansal
- 673
- 2
- 7
- 19
-
you can't, really. at most you can confirm that the entire file was sent out on the wire, but there's no practical way to confirm that the file was actually received by the user. – Marc B Jul 02 '14 at 21:19
-
you can have to user "upload" it to JS using an , and from there you can check file name, even run a CRC/MD5 if you want. but why? – dandavis Jul 02 '14 at 21:25
2 Answers
0
For checking download with Chrome browser
The set up you can go for is as per the following
https://stackoverflow.com/a/26127745/511069
As suggested here https://stackoverflow.com/a/27031924/511069
you can create a function waitFileExists(fileAbsPath) and performs your expectations after the file is completely downloaded
0
var downloadfile = path.join(__dirname,'\\dash-e2e-tests\\resources\\files-cabin\\download-files');
capabilities: {
browserName: 'chrome',
'chromeOptions': {
prefs: {
download: {
'prompt_for_download': false,
'directory_upgrade': true,
'default_directory': downloadfile
}
}
}
},
Use tabove code under cof.js file and once test case is done verify the file availability under given location.

Shiwantha Lakmal
- 17
- 5