Recommendations for "E225: DOM failed to be ready" error

With “script” you mean the macro or the calling (Powershell) script?

Note that in the macro you must use OnDownload to wait for the download to complete.