Search code examples
automationanywhere

How to loop through a web table column and download multiple PDF files using Automation Anywhere?


I have an HTML table that has seven columns and 3 rows (the number of rows may be more or less). The second columns contains a links to PDF files and the seventh column contains the phrase "Corrective Action" I only want to download the PDF files from the columns that contain the word "Corrective Action". However, my code is only downloading the first PDF.

Here is the code: http://dev.atriumfinehomes.com/clonewebtable/sample.PNG

This is the table: http://dev.atriumfinehomes.com/clonewebtable/table.htm

Could I get some help with this please?


Solution

  • Get the links of the PDF files using Extract Table command.

    Steps to get the links:
    - Edit the Extract Table command -> Advanced view -> Step 6: Extract Selected Tag details to CSV file. Tag Name: Hyperlink, Attribute Name: Get URL.
    - Save the data to another CSV file. (You can't save it in the same file as it will append or overwrite).
    - Open the file CSV file as a spreadsheet.

    Extract Table Command

    Inside the loop
    - Create a new variable $vCounter$, because the links.csv file dosn't conation headers as the table.
    - Using variable operation assign $Counter$-1 to $vCounter$.
    - Using Get Cells command and get cell A$vCounter$ and assign it to a new variable $vPDFURL$.
    - Use $vPDFURL$ as Download file URL in the download command.

    Taskbot command for more clarification