Wait for download is still running when there is no data available to download

Hello community!

I have multiple names stored in array and i am looping this names to download the pdf’s from a website… when bot click to a pdf img icon to download pdf’s sometime there is a error while downloading,the error is like this example-pdf???

This error means there is no pdf available to download so i have used element exist in wait for download and in if activity i have used continue activity…but still my wait for download activity is running?
Is there any other logic to get out of wait for download when there is no pdf available to download?

@Priyesh_Shetty

This would not work…continue and break are for looping statements

So inside wait for download you need to keep an action which is the final step to start the download of a file…

If click on pdf is the final strp and after clicking only you would know if file is present or not…then keep the wait for download inside try catch…and if element exists then set a boolean variable to true…and in catch block check if the boolean is true then dont throw any error else throw an error that file is not downloaded…this way when pop up is there even if wait for download throws an error you can suppress it and in other case there is no error at all

Cheers

@Anil_G i have kept this in loop only so for that i have used continue activity…Because there are multiple pdfs i need to download from a website…if there is no pdf available to download then bot should skip that and it should open another url to download the pdf.

@Priyesh_Shetty

Then as mentioned pelase use wait for download in try cqtch in catch block check the boolean and then continue accordingly

Cheers

@Anil_G in catch block i should use a element exist bool variable or should i create a new bool variable?

@Priyesh_Shetty

Keep the last click in the wait for download…next activity as element exists

And keep wait for download in try catch

In catch block use if condition with output of element exists…if element exists is true then click on it and use continue on else side raise an error that download is not successful

Check

@Anil_G i tried this but it is executing the outer catch block.

@Priyesh_Shetty

What do ypu mean outer catch?

Can you please show what you dif and what happended?

Cheers

@Anil_G i mean i have created a xaml for downloading this pdfs…And exception is getting catched in outer xaml where i have done open browser and selecting the required option on a website steps.

@Priyesh_Shetty

Did you keep try catch around wwait for download?

Cheers