Robotic Process Automation (RPA)

 View Only

 Drag and drop files to webpage

Bob Riaz's profile image
Bob Riaz posted Fri January 16, 2026 08:53 AM

Hello all,

I am working on an automation to upload files to a webpage which has two options to upload a file: a drag and drop control (dropzone) or a file type html input (<input type='file'...>). So the script needs to be able to select files from an explorer window of the local files system and drag them over to the webpage dropzone and drop them there or set those files to the input element and trigger an event that will cause the webpage to do the upload. 

Things I have tried so far:

  1. For the drag and drop option I thought I would record mouse clicks in an explorer window (Ctrl+A to select all files, then left mouse click etc) but this does not seem to work - Studio does not seem to be able to map any elements in the window. The script is able to open an explorer window but clicking Ctrl and hovering in the window does not give the green indicator of a mapping having taken place. This is probably because the Launch and Attach window command, while it works to open the window, does not return a reference to that window. I realized this when I added a Focus Window command right after the Launch and Attach and the Focus command failed because the variable to hold the window reference was null.
  2. For the <input type='file ' element, I tried running some Javascript to fire drag and drop events with the files added to the DataTransfer object, and while this ran without errors, the drop event had no effect on the webpage.

Thanks for reading this post. All thoughts and suggestions greatly appreciated!

Best regards,

Bob

Mark Johnson's profile image
Mark Johnson

Don’t try to automate Explorer or drag-and-drop — most RPA tools can’t reliably control OS file dialogs. The correct approach is to target the <input type="file"> element directly and set its value to the file path (using the tool’s “Set File” / “Upload File” action), which triggers the upload without any UI interaction.

If the site hides the input behind a dropzone, inspect the DOM — it’s usually still there and usable.