NOTE! You can take a look at our most recent post on this topic, that is updated with the most recent features: https://powergi.net/2022/07/11/everything-about-downloading-files-from-the-web-using-power-automate/
Power Automate has evolved a lot in the recent months, and with their Desktop application they have expanded the possibilities of automation. However, it has limitations when it comes to download files from the web, still, Microsoft offers a way to work around this: the Desktop recorder.
Known issues to download files from the web
When trying to download a file from a link or a button, or using a PDF download button, we may think of using the “Click download link on web page” action:
But once we run the flow to test it in either Chrome, Firefox or Edge, we’ll get this error:
Yikes! The option is only available for their out of the box “Automation Browser” (which is based on Internet Explorer… which we know for not being so cool to use!)
Now we’re thinking: “Ok, let’s use the Automation Browser”, which works for some cases, but this browser has compatibility issues and not all pages load correctly, so even if the option to download can be used there, you still have the regular issues of the Internet Explorer navigation. Below error sometimes happen:
Solution: Use the Desktop Recorder to Download from the web
Even with all the issues, Power Automate offers a workaround that works flawlessly (at least to me so far): use the Desktop Recorder! Let’s take a look:
First thing, lets launch Chrome (We’ll be using this website for this example: https://pdfobject.com/):
And here’s the trick: Use web recorder for all actions in your webpage (like login, search, filter, etc) but once you reach the download step, use the Desktop Recorder (UI Automation features).
So, let’s switch to the “Desktop Recorder” and record the download process, then click on “Finish.”
This will automatically generate the steps that we need to click on the download button and to also save into the folder we want:
Now you can adapt this to your process and dynamically create paths for your files to be downloaded into the location you need and with the name that you want.
Note that sometimes Power Automate tries to Edit the file name field before the window becomes visible in the screen. Search for the “Wait for window” option and select the “Button ‘Save'” or the “Edit Field” Element, finally, make sure that “Focus windows after it opens” is set to ON.
After that, just run the flow and see it working!
Additional Note for PDF Viewer that have identifiers
If your process involves downloading different files every time that refer to different objects, it may be that PDF viewer elements include some type of identifier that when you try to use the same flow for a different PDF, Power Automate doesn’t find the PDF download button, for those cases go to View->UI Elements and in the right panel search for the download element
In the next screen, select the three dots and click on Edit selectors
In the editor, change to:
document > button[Id=”download”]
You can also see our video for a step-by-step walkthrough: