Wait for the download to finish

Guys, I have a link that downloads a report, but sometimes it’s quick and sometimes it takes a while, !TIMEOUT_DOWNLOAD never worked or I was never able to use it. I would like to wait until the download is done for the macro to continue with the Loop, how can I do this?

Sometimes it takes a while and displays the following error: [error]
Line 1: E225: DOM was not ready in 30 seconds.

{
  "Name": "DOWNLOAD_RELATÓRIO",
  "CreationDate": "2024-10-31",
  "Commands": [
    {
      "Command": "selectWindow",
      "Target": "tab=open",
      "Value": "https://emec.mec.gov.br/emec/mec/relatorio-ies/gerar-csv?co_relatorio_ies=2",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "!TIMEOUT_DOWNLOAD",
      "Value": "60",
      "Description": ""
    }
  ]
}

If you want Ui.Vision to wait for the download to complete, you :warning: must add the OnDownload command to the macro! You can put it anywhere in the macro, but before the download-click.

Without this command, the macro does not wait.