Skip to content

Check Downloads

Monitor and verify download status in the browser's download list with support for filename pattern matching and custom filtering.

Configuration Options

OptionDescriptionRequired
Run the action process in the background?If enabled, this field runs in background while next field executesNo
Do you want to click on an element?Enable to click on an element before checking downloadsNo
Enter Element Selector/XpathSelector or XPath for the element to click (when click option is enabled)Conditional
FilenameCheck specific file name in browser download list using regex patternsNo
Downloads Item StatusDesired download status to check forYes
Wait until the download items status matchesWait until specified status is reachedNo

Run in Background

Toggle: Run the action process in the background?

Description: When enabled, this field action runs in the background and the next field action executes immediately without waiting for download completion.

Use Case: When you want to continue automation while monitoring downloads in parallel.


Click on Element

Toggle: Do you want to click on an element?

Description: When enabled, the extension will click on a specified element before checking the download status. This is useful when you need to trigger a download by clicking a button or link before monitoring the download.

Element Selector/Xpath: Enter the CSS selector or XPath for the element you want to click.

Use Cases:

  • Click a download button that initiates a file download
  • Click a link that triggers a download
  • Interact with elements that start the download process

Examples:

CSS Selector:

#download-btn
.download-button
button[data-action="download"]
a.pdf-download

XPath:

//button[@id='download-btn']
//a[contains(text(), 'Download')]
//button[contains(@class, 'download')]
//div[@class='actions']//button[1]

Workflow

  1. The extension clicks the specified element
  2. Waits for the download to start
  3. Monitors the download status based on your configuration

Important

Make sure the element selector is accurate and the element is visible/clickable on the page before the field executes.


Filename

Set in: Field Default Value or Excel Field Column

Description: Check for specific file name in the browser's download list (not in PC download folder). Uses regex patterns for flexible matching.

Important

If you don't set a filename, the field type will check the status of all files in the download list.

Regex Pattern Examples

Example Path / FilenameRegex PatternDescription
report.pdf.*report\.pdf$Exact file name ending with report.pdf
monthly-report.pdf.*-report\.pdf$Hyphenated report file
annual_report.pdf.*_report\.pdf$Underscore-separated report
Reports/2025/report.pdfReports/2025/.*\.pdf$Any PDF inside Reports/2025 folder
Downloads/report_2024.pdf.*report_\d{4}\.pdf$Report with 4-digit year
finance-report-v2.pdf.*report-v\d+\.pdf$Versioned report files
report(1).pdf.*report\(\d+\)\.pdf$Duplicate download naming
FINAL_REPORT.PDF.*final_report\.pdf$ (i)Case-insensitive final report
invoice_12345.pdf.*invoice_\d+\.pdf$Invoice with numeric ID
Invoices/Jan/invoice.pdfInvoices/.*/invoice\.pdf$Invoice inside any subfolder
notice_SH_151_196.pdf.*notice_SH_\d+_\d+\.pdf$Structured notice file
SH_151_196_SHRD_14581300.pdf.*SH_\d+_\d+_SHRD_\d+\.pdf$Election-style reference file
formA-2025-01.pdf.*formA-\d{4}-\d{2}\.pdf$Date-formatted form
backup/report_old.pdf.*report_.*\.pdf$Report with suffix
Reports/finance.xlsxReports/.*\.xlsx$Any Excel file in Reports folder
statement.csv.*(csv|xlsx)$CSV or Excel file
docs/report.pdf.*/report\.pdf$report.pdf in any folder
report.pdf^report\.pdf$Only root-level filename
2025_report_final.pdf.*\d{4}_report_.*\.pdf$Year-prefixed report
summary-notice.pdf.*(summary|notice).pdf$Summary OR notice files

Common Regex Patterns:

  • .* - Match any characters
  • \. - Match literal dot (escape the dot)
  • \d - Match any digit (0-9)
  • \d{4} - Match exactly 4 digits
  • \d+ - Match one or more digits
  • $ - End of string
  • ^ - Start of string
  • (a|b) - Match 'a' OR 'b'
  • [abc] - Match any character in brackets

Downloads Item Status

Options:

  • Progress - The download is in progress
  • Complete - The download is complete
  • Broke Connection - The download encountered a broken connection

Description: Specify the desired download status you want to check for.


Wait Until Status Matches

Toggle: Wait until the download items status matches

Description: When enabled, the field waits until the specified download status is reached. If disabled, the field reports the current status without pausing execution.


Custom Filter

For advanced filtering of download items, use a JavaScript event listener in a separate JavaScript Code field type.

Implementation Steps

Use three field types in sequence:

  1. JavaScript Code - Add event listener
  2. Check Downloads - Trigger event and pass download details
  3. getLocalStorage function - Check if filter is complete

JavaScript Event Listener

js
// Listen Event
window.addEventListener('EDF-CHECK-DOWNLOADS-RESPONSE', (e) => {
  if (e && e.detail && e.detail.response) {

    // Use for loop to search and match item details according to your needs
    for (let i = 0; i < e.detail.response.length; i++) {
      const item = e.detail.response[i];
      console.log("Item", item)
      
      // Example: Check if specific file exists
      if (item.filename.includes('report.pdf') && item.state === 'complete') {
        // If match found, store value in local storage
        $fns.setLocalStorage("is-found-download", "1");
        break;
      }
    }
  }
});

// RETURN - if don't use this line then extension will pause on this field
$fns.return("1");

Event Variable Structure

Event Variable: e.detail.response

Data Type: Array of download item objects

Example Response:

json
[
  {
    "bytesReceived": 707486,
    "canResume": false,
    "danger": "accepted",
    "endTime": "2026-01-15T08:16:17.120Z",
    "exists": true,
    "fileSize": 707486,
    "filename": "C:\\Users\\xyz\\Downloads\\dev-example.pdf",
    "finalUrl": "https://example.com/downloads/pdf/dev-example.pdf",
    "id": 113,
    "incognito": false,
    "mime": "application/pdf",
    "paused": false,
    "referrer": "https://example.com/downloads/pdf/",
    "startTime": "2026-01-15T08:15:51.970Z",
    "state": "complete",
    "totalBytes": 707486,
    "url": "https://example.com/downloads/pdf/dev-example.pdf"
  }
]

Download Item Properties

PropertyTypeDescription
bytesReceivednumberNumber of bytes received so far
canResumebooleanWhether download can be resumed
dangerstringDanger type (e.g., "accepted", "file", "url")
endTimestringISO timestamp when download completed
existsbooleanWhether file still exists
fileSizenumberTotal file size in bytes
filenamestringFull path to downloaded file
finalUrlstringFinal URL after redirects
idnumberUnique download ID
incognitobooleanWhether downloaded in incognito mode
mimestringMIME type of file
pausedbooleanWhether download is paused
referrerstringReferrer URL
startTimestringISO timestamp when download started
statestringDownload state: "in_progress", "complete", "interrupted"
totalBytesnumberTotal file size in bytes
urlstringOriginal download URL

Usage Examples

Example 1: Wait for Specific File Download

Field Type: Check Downloads
Filename: .*report\.pdf$
Downloads Item Status: Complete
Wait until status matches: ✅ Enabled

Result: Waits until any file matching "report.pdf" is completely downloaded.


Example 2: Check All Downloads (No Filename)

Field Type: Check Downloads
Filename: (empty)
Downloads Item Status: Complete
Wait until status matches: ✅ Enabled

Result: Waits until all downloads are complete.


Example 3: Background Download Monitoring

Field Type: Check Downloads
Run in background: ✅ Enabled
Filename: .*invoice_\d+\.pdf$
Downloads Item Status: Complete
Wait until status matches: ✅ Enabled

Result: Monitors invoice downloads in background while next field executes.


Example 4: Click Download Button and Wait

Field Type: Check Downloads
Do you want to click on an element?: ✅ Enabled
Enter Element Selector/Xpath: #download-report-btn
Filename: .*monthly-report\\.pdf$
Downloads Item Status: Complete
Wait until status matches: ✅ Enabled

Result: Clicks the download button, then waits until the monthly report PDF is completely downloaded.

Use Case: Automate clicking download buttons and verify the download completes successfully.


Field Type: Check Downloads
Do you want to click on an element?: ✅ Enabled
Enter Element Selector/Xpath: //a[contains(text(), 'Download Invoice')]
Filename: .*invoice_\\d+\\.pdf$
Downloads Item Status: Complete
Wait until status matches: ✅ Enabled

Result: Clicks the "Download Invoice" link using XPath, then monitors until the invoice PDF download completes.


Example 6: Custom Filter Workflow

Field 1 - JavaScript Code:

js
window.addEventListener('EDF-CHECK-DOWNLOADS-RESPONSE', (e) => {
  if (e && e.detail && e.detail.response) {
    for (let i = 0; i < e.detail.response.length; i++) {
      const item = e.detail.response[i];
      
      // Check for PDF files over 1MB
      if (item.mime === 'application/pdf' && item.fileSize > 1000000) {
        $fns.setLocalStorage("large-pdf-found", "1");
        break;
      }
    }
  }
});
$fns.return("1");

Field 2 - Check Downloads:

Downloads Item Status: Complete
Wait until status matches: ✅ Enabled

Field 3 - getLocalStorage Function:

Function Value: [large-pdf-found][true][true]

Result: Waits for large PDF download, stores result, and verifies completion.


Example 5: Pattern Matching with Variables

Field Type: Check Downloads
Filename (from Excel): {$expectedFilename$}
Downloads Item Status: Complete
Wait until status matches: ✅ Enabled

Excel Data:

  • expectedFilename: .*report_2025.*\.pdf$

Result: Dynamically matches files based on Excel data.


Tips

Click on Element

When using "Do you want to click on an element?", ensure the element is visible and clickable before the field executes. Use specific selectors to avoid clicking the wrong element.

Selector Testing

Test your CSS selectors or XPath expressions in the browser console before using them:

  • CSS: document.querySelector('#download-btn')
  • XPath: $x("//button[text()='Download']")

Download Timing

After clicking an element to trigger a download, there may be a slight delay before the download appears in the browser's download list. The extension will wait for the download to start before checking its status.

Regex Patterns

Use regex patterns in the Filename field for flexible matching. Test your patterns at regex101.com before using them.

Background Processing

Enable "Run in background" when you want to continue automation while monitoring downloads. This is useful for long-running downloads that shouldn't block other actions.


Use Cases

Verify File Download Completion

Scenario: Ensure a specific file has finished downloading before proceeding.

Configuration:

  • Filename: .*contract\.pdf$
  • Status: Complete
  • Wait: Enabled

Monitor Multiple Downloads

Scenario: Check if all downloads are complete.

Configuration:

  • Filename: (empty)
  • Status: Complete
  • Wait: Enabled

Custom Validation

Scenario: Verify downloaded file meets specific criteria (size, type, etc.).

Configuration:

  • Use custom filter with JavaScript
  • Check file properties in event listener
  • Store validation result in localStorage

Background Download Check

Scenario: Continue automation while monitoring downloads.

Configuration:

  • Run in background: Enabled
  • Filename: .*data\.csv$
  • Status: Complete

Automated Download Triggering

Scenario: Click a download button and wait for the file to complete downloading.

Configuration:

  • Do you want to click on an element?: Enabled
  • Enter Element Selector/Xpath: #download-btn or //button[text()='Download']
  • Filename: .*report\\.pdf$
  • Status: Complete
  • Wait: Enabled

Use Case: Automate the entire download process from clicking the button to verifying completion.

Released under the MIT License.