Skip to main content

file-download Scenario 3 — Download Multiple PDFs with Titles

Written by RTILA X Engineering Team

Intermediate ~6 min
Prerequisites: file-download/1

What You'll Learn

Move, rename, or copy downloaded files

Real-World Use Case

Organising automated downloads into folders

LIVE DEMO

Multiple PDF Downloads

A document list whose links download PDFs via the /files/* attachment rule.

Annual Report 2024 Download PDF 2.4 MB
Q4 Financial Summary Download PDF 1.1 MB
Product Roadmap Download PDF 3.7 MB
Team Handbook Download PDF 890 KB
EXPECTED OUTPUT

Documents

title href
Annual Report 2024 /files/annual-report-2024.pdf
Q4 Financial Summary /files/q4-financial-summary.pdf
Product Roadmap /files/product-roadmap.pdf
Team Handbook /files/team-handbook.pdf
RTILA X PROJECT JSON

RTILA X Automation Project

download-multiple-pdfs.json
{
  "name": "Download_Multiple_PDFs",
  "settings": {
    "urls": [
      "https://learn.rtila.com/scenarios/file-download/3"
    ]
  },
  "datasets": {
    "documents": {
      "item_selector": "css=.document-item",
      "properties": [
        {
          "name": "title",
          "type": "text",
          "selector": "css=.doc-title"
        },
        {
          "name": "href",
          "type": "attribute",
          "selector": "css=a.doc-link",
          "attribute": "href"
        }
      ]
    }
  },
  "commands": [
    {
      "command": "for_each",
      "params": {
        "source_type": "dataset",
        "dataset": "documents",
        "as": "doc",
        "do": [
          {
            "command": "wait_for_download",
            "params": {
              "selector": "css=a.doc-link[href='${doc.href}']",
              "save_path": "./downloads/${doc.title}.pdf"
            }
          }
        ]
      }
    }
  ]
}

RTILA X Concepts

Batch downloads combine a dataset extraction with a for_each loop. Each iteration clicks the download link and waits for the file to finish downloading.

Did you complete this scenario?

Ready to run this automation?

Copy the project JSON above, open RTILA X, create a new project, and paste it.

This scenario covers 1 RTILA X command and is referenced in 1 learning article.

Continue Learning

Was this helpful?