Skip to main content
Optexity can download files from websites and upload files to forms.

Download Methods

MethodTrigger
Click download linkclick_element with expect_download=true
Select export optionselect_option with expect_download=true
Save page as PDFdownload_url_as_pdf

Click to Download

{
  "interaction_action": {
    "click_element": {
      "command": "get_by_role(\"button\", name=\"Download Report\")",
      "expect_download": true,
      "download_filename": "monthly_report.pdf"
    }
  }
}
PropertyTypeDefaultDescription
expect_downloadboolFalseAction triggers download
download_filenamestr | NoneAuto-generated UUIDFilename for download

Select to Download

{
  "interaction_action": {
    "select_option": {
      "command": "get_by_label(\"Export Format\")",
      "select_values": ["CSV"],
      "expect_download": true,
      "download_filename": "data.csv"
    }
  }
}

Save Page as PDF

Capture current page or specific URL as PDF:
{
  "interaction_action": {
    "download_url_as_pdf": {
      "download_filename": "page_snapshot.pdf"
    }
  }
}

Multiple Downloads

Use for_loop_node to download multiple files:
{
  "type": "for_loop_node",
  "variable_name": "doc_ids",
  "nodes": [{
    "type": "action_node",
    "interaction_action": {
      "click_element": {
        "command": "get_by_text(\"{doc_ids[index]}\")",
        "expect_download": true,
        "download_filename": "doc_{doc_ids[index]}.pdf"
      }
    }
  }]
}
Use variable substitution in download_filename to create unique filenames.

Upload Files

{
  "interaction_action": {
    "upload_file": {
      "command": "get_by_label(\"Upload Document\")",
      "file_path": "/path/to/document.pdf",
      "prompt_instructions": "Upload the document"
    }
  }
}
PropertyDescription
command / xpathLocator for file input
file_pathAbsolute or relative path (supports variables)

Download Storage

Downloaded files are stored in the task’s downloads directory:
/tmp/optexity/{task_id}/downloads/
├── monthly_report.pdf
├── data.csv
└── doc_123.pdf

Waiting for Downloads

Optexity automatically waits for downloads when expect_download=true. For large files, increase timing:
{
  "type": "action_node",
  "interaction_action": {
    "click_element": {
      "command": "get_by_text(\"Download Large File\")",
      "expect_download": true
    }
  },
  "end_sleep_time": 10.0
}

Best Practices

PracticeRecommendation
Set expect_downloadAlways when download is expected
Use descriptive filenamesInclude IDs or dates
Handle large filesIncrease end_sleep_time
Validate upload pathsEnsure absolute paths are accessible