Optexity can download files from websites and upload files to forms.
Download Methods
| Method | Trigger |
|---|
| Click download link | click_element with expect_download=true |
| Select export option | select_option with expect_download=true |
| Save page as PDF | download_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"
}
}
}
| Property | Type | Default | Description |
|---|
expect_download | bool | False | Action triggers download |
download_filename | str | None | Auto-generated UUID | Filename 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"
}
}
}
| Property | Description |
|---|
command / xpath | Locator for file input |
file_path | Absolute 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
| Practice | Recommendation |
|---|
Set expect_download | Always when download is expected |
| Use descriptive filenames | Include IDs or dates |
| Handle large files | Increase end_sleep_time |
| Validate upload paths | Ensure absolute paths are accessible |