Download and pause

Hello everyone, im using Katalon Recorder and im trying to download a file clicking a button in a web page.
The command is not particulary sofisticated, it is just:
click | xpath=//button[@id=‘A6428:formInfo:j_idt208’]/span[2]

it works, the target object exists, the download start and then finish, i can see the xls in the “download” folder… but…

The next command, it doesnt matter wich one, never works, it stays in yellow and never turns green

ive changed the command so all of them work, for example:
runScript | document.querySelector(“button[id=‘A6428:formInfo:j_idt208’]”).click();

The web page, is not reloaded and it doesnt post to the server, it works just downloading (this means that i dont lose the objects so i dont need to waitForElementPresent or something similar)

ive tested in diferent pc and the next command never works

1 Like

Hi there, and thanks for posting in the Katalon community! :hugs:

To help you faster, please review our guide on Katalon Recorder here: Katalon Recorder overview | Katalon Docs. Double-checking the steps and configurations might resolve the issue.

If the doc doesn’t help, feel free to provide more details, and a community member will assist you soon. Thanks for being a part of our community!

Best,
Elly Tran

To resolve the issue where subsequent commands in Katalon Recorder fail after triggering a file download, follow these steps:

Issue Explanation

When a file download starts, browsers may block further script execution until the download completes. Katalon Recorder (a browser extension) might wait indefinitely for a page event (e.g., a reload) that never happens, causing the next command to hang.

Solution 1: Add a Manual Delay

Insert a pause command after the download to give the browser time to process the download:

runScript | document.querySelector("button[id='A6428:formInfo:j_idt208']").click();
pause | 3000  // Waits 3 seconds (adjust as needed)

Replace the next command after the pause.

Solution 2: Use JavaScript to Bypass Browser Locks

Trigger the download via JavaScript and disable event propagation to prevent blocking:

runScript | document.querySelector("button[id='A6428:formInfo:j_idt208']").click();
runScript | window.onbeforeunload = null;  // Disable download-related page locks

Solution 3: Configure Browser for Silent Downloads

Set the browser to auto-download without prompts (prevents UI freezes):

  1. Chrome/Firefox Settings:
  • Disable download prompts (via about:config in Firefox or Chrome policies).
  1. Katalon Desired Capabilities (if using automation):
# For Chrome
chromeOptions.prefs.download.default_directory = /path/to/downloads
chromeOptions.prefs.download.prompt_for_download = false

Solution 4: Use storeEval to Wait for a Condition

Add a JavaScript loop to wait for a page element or a fake flag after download:

runScript | document.querySelector("button[id='A6428:formInfo:j_idt208']").click();
storeEval | for (let i = 0; i < 10; i++) { if (document.querySelector('.post-download-element')) break; await new Promise(resolve => setTimeout(resolve, 1000)); } | 

Solution 5: Split the Test Case

Separate the download step from subsequent actions:

  1. Test Case 1: Trigger the download.
  2. Test Case 2: Handle post-download steps (run after manual confirmation of download).

Notes

  • Avoid Standard click Commands: They may wait for page events that never occur. Use runScript instead.
  • Adjust Pause Durations: Increase pause time if downloads are slow.
  • Check Browser Logs: Use the browser console (F12) to debug JavaScript errors during execution.

By implementing these fixes, Katalon Recorder should proceed with commands after the download completes. If issues persist, consider migrating to Katalon Studio for advanced handling of file downloads (e.g., WebUI.downloadFile).