Skip to content

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.

  1. Starts “listening” for downloads in the indicated page session.
  2. Execute the body activities (which trigger the download).
  3. Wait for the file to finish downloading and save it to outputPath.
  4. Returns the full path of the saved file.
ParameterEditorDescription
sessionsessionThe page session (ZoanPageSession of Open Browser or New Page). Pass = page.
ParameterEditorDescription
outputPathtextFolder or file path where to save. If you give a folder, use the name suggested by the browser. By default, the system temporary folder.
timeoutnumberMaximum time (ms) to wait for the download to start. By default 30000.

The activities that trigger the download (a click on the download button, an export link).

Returns a string with the full path of the downloaded file.

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: libro