i have files in website to download like there will be one file 2 files or many i want to download all the files and delete , shall i take row count loop it till it becomes zero count. Or what is the best logic to write
any solution on this
Hi @T_Y_Raju
It’s better if you can share a screenshot how is your website showing for downloading the files, Is this a tabular or some other formats?
Thanks,
Srini
Hi, To download files from a website, especially when you don’t know in advance how many files there are, you can use a loop to repeatedly check and download files until there are no more files left to download. However, a loop based on a row count might not be the most efficient approach if the file list is dynamic or if there’s no convenient way to determine the total count of files in advance.
-
Use the “Find Children” Activity: Use the “Find Children” activity to locate and extract all the download links or elements from the web page. The “Find Children” activity is designed for scraping data from a collection of elements, such as links.
-
Iterate Over the Elements: Use a “For Each” loop to iterate over the collection of elements (download links) found by the “Find Children” activity.
-
Inside the Loop:
- Click on the download link to initiate the download.
- You can use the “Click” activity to do this. After clicking, a download dialog or action should be initiated depending on the website’s behavior.
- Handle the download action or dialog: Depending on the website and the way it handles downloads, you may need to add further actions, like saving the file to a specific location on your system.
-
Continue Looping: Continue the loop until all files have been downloaded. You can use the loop condition or check if any more elements are available for download.
-
- Ensure you handle any error or exception scenarios during the download.
- Consider setting up a mechanism to wait for the download to complete before proceeding to the next iteration.
- If you need to delete files after downloading, add a step within the loop to delete the downloaded file once it’s no longer needed.