Hi folks,
I thought that I would share this little tip that I use to wait for files that are being downloaded.
(Made some edits after feed-back from Russ )
Thanks,
Dave
//Uses Java file.exists() method
//First create the GlobalVariable in any Katalon profile
GlobalVariable.Directory = (System.getProperty('user.home') + '\\Downloads\\')
println('Directory: ' + GlobalVariable.Directory)
def src = new File(GlobalVariable.Directory + 'filename')
//----------------------------------------------------
int TIMEOUT_SECONDS = 20
int count = 0
while (count < TIMEOUT_SECONDS) {
count++
WebUI.delay(1)
System.out.println('TIMEOUT_SECONDS: ' + count)
//Waits for src to download; if not found breaks
if (src.exists()) {
println('FileExists: ' + src.exists())
break
}
}
println "Do something with the src file... "