I opted to use the isFile()
method from this thread which requires absolute path to the file.
boolean doesFileExist = new File("C:/downloads/MyFile.txt").isFile();
I have gotten Selenium and Robot class to save the text file to a local directory but the file name is dynamic: MyTextFile_YYYYMMDDHHMMSS.txt
. However, MyTextFile_
always remains the same. I want to check just with a partial file name match.
What is an elegant way to do this?