Wait while page loads to click save button

I am working on automating a BI report. When I click the view report button the page loads with a javascript loading image and the save file button is not enabled until the file finishes loading. What is the proper way to wait until the file is loaded before clicking the save button? I have tried setting a loop to look every 5 seconds for when the property is enabled, this works for small load times but for some reason it is not working when the page takes longer to load. I had to manipulate the for loop to get it to work for a faster loading report. The report can take up to 10 minutes or longer sometimes before the save button is available to click. Any suggestions?

@ZachT124 It looks to me like you are doing everything correctly. Essentially, you are looping to check the Enabled status for N iterations with a pause of X ms for each iteration. One thing you could potentially do is to loop for a set period of time. Here is an example; basically, get the time when you start the loop and add your interval to that. Set the ForLoop to have a limit of -1 which will effectively make it endless. Use a Boolean variable to determine how you broke out of the loop (i.e. set it to True when you reach your timeout for example). This is a pretty good way to wait for things that take a long time. You could also tweak your loops to coordinate your iterations with the pause duration to make it wait longer. Right now, you are only waiting for 5 seconds (10 iterations with a 500 ms pause). I like to use the infinite loop with a DateTime variable as it means you really only need to set your wait duration in one place and you don’t need to do much mental math.

@ThomasSasnett I like the idea of what you described but I am not quite sure how to construct the date-time comparison. Here is what I have now. Could you show me an example?

@ZachT124 Here is my example.

Project11.zip (18 KB)

@ThomasSasnett Works great. Thank you for your help!