How to check if a file got downloaded in java selenium tests
How to check a file exists in system:
//we use import java.io.File;
File f = new File("D:\\program.txt");
f.exists(); // this will print true or false whether the file program.txt exists
We can use this logic to check if the file got downloaded and is available at the location.
But sometimes we need to click download button and wait for like few mins or seconds for the download to finish.