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

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

RTILA X PROJECT 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": "wait_for_selector",
      "params": {
        "selector": "css=.document-item"
      }
    },
    {
      "command": "extract_data",
      "params": {
        "dataset": "documents"
      }
    },
    {
      "command": "for_each",
      "params": {
        "source_type": "dataset",
        "dataset": "documents",
        "as": "doc",
        "do": [
          {
            "command": "click",
            "params": {
              "selector": "css=a.doc-link"
            }
          },
          {
            "command": "wait_for_download",
            "params": {
              "selector": "css=a.doc-link"
            }
          }
        ]
      }
    }
  ]
}
  

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?