I’m using Watin to automate download file from a website. At some point a timeout error occurs if the webserver does not respond in certain time. I would like to know for what index the timeout occurs and for that index to repeat the for loop.
For example:
for (int index = 0; index < ros.Count; index++)
{
//download document
FileDownloadHandler down = new FileDownloadHandler(dir+nume+"_"+ro+".pdf");
using (new UseDialogOnce(browser.DialogWatcher, down))
{
down.WaitUntilFileDownloadDialogIsHandled(100);
down.WaitUntilDownloadCompleted(100);
}
}
When the timeout occurs i want to know for what index in for loop and i would like to retry the download handler. Is it possible ?
Most likely the timeout throws an exception. You should figure out which exception exactly is thrown, and then you can catch it inside your loop: