Wait for Download
Wait for Download
Section titled “Wait for Download”Type: page-wait-for-download · Package: Browser v1.0.0 · Output: string
Download a file from the page reliably. You wrap inside your body the action that triggers the download (a click on “Download”, an export link to PDF/Excel) and the activity waits for the download to finish, returning the full path of the saved file.
It solves a classic problem: if you just click “Download” and continue, the file may not have finished downloading when the next activity tries to open it. This activity synchronizes both things.
How it works
Section titled “How it works”- Starts “listening” for downloads in the indicated page session.
- Execute the
bodyactivities (which trigger the download). - Wait for the file to finish downloading and save it to
outputPath. - Returns the full path of the saved file.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
session | session | The page session (ZoanPageSession of Open Browser or New Page). Pass = page. |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
outputPath | text | Folder or file path where to save. If you give a folder, use the name suggested by the browser. By default, the system temporary folder. |
timeout | number | Maximum time (ms) to wait for the download to start. By default 30000. |
Subflows (lanes)
Section titled “Subflows (lanes)”body optional
Section titled “body optional”The activities that trigger the download (a click on the download button, an export link).
Output
Section titled “Output”Returns a string with the full path of the downloaded file.
Example
Section titled “Example”Export a report to Excel and obtain its path to process it:
Wait for Download session = = page outputPath = "C:\Descargas\reportes" └─ body: Page Click selector = (#exportarExcel) → output: rutaReporte
Excel Open path = = rutaReporte → output: libroRelated activities
Section titled “Related activities”- Click — the typical action within
body. - Excel Open / Read File — process the downloaded file.