Hello, I wrote an automation test in Webdriver Selenium using C #, and one of the steps requires downloading an XLSX file from the server.
How can I validate that the file has been successfully downloaded and get its name?
Hello, I wrote an automation test in Webdriver Selenium using C #, and one of the steps requires downloading an XLSX file from the server.
How can I validate that the file has been successfully downloaded and get its name?
There are several ways to validate that the file is complete. One way to validate is to take the CRC32 checksum of the file BEFORE and validate the file you downloaded and compare the values.
On Linux, the command is
cksum arquivo.txt
The output will be
linux@ubuntu:~$ cksum arquivo.txt
3474990042 214 arquivo.txt
Where the first code is the CRC32 of the file, the second is the number of bytes and the third is the name of the file.
Another, which I particularly like more, is to use the MD5Sum file as follows:
linux@ubuntu:~$ md5sum arquivo.txt
and the answer will be
cbc8ccd6c7f5a111f494cfd4e0aea86e arquivo.txt
where the first column will be the MD5 hash of the file and the second, the name of the file itself.