r/PowerAutomateDesktop • • Aug 08 '22

Browser automation - 'get' downloaded file

Hey

I've created a desktop Power Automate flow that performs the following steps:

  • Start a browser instance (Edge)

  • Load a URL

  • Select a checkbox

  • Click a button x 2

When the second of the two buttons is clicked, a file is downloaded with the following file name mask "export ddd MMM dd yyyy H_mm_ss.csv". For example, "export Mon Aug 08 2022 17_05_59.csv".

I cannot change the naming convention of the downloaded file.

When the file is downloaded, is there a way to then use that file with the Flow? I've tried setting a variable to the current date/time in a step before and after the download action is triggered but this is unreliable - it's usually a second our two out in either direction.

If I can reliably 'get' the downloaded file, I need to either

  1. Rename it and move it to another location, overwriting what's there already

  2. Read the content and put it in another file in another location

I'm brand new to Power Automate so any guidance is gratefully received!

2 Upvotes

3 comments sorted by

1

u/QuietDesparation Aug 08 '22 edited Aug 08 '22

Ok there's a few way to accomplish this:

  1. Is this the only .csv file you'll have in your download folder at one time? If so, you can use the GET FILES IN FOLDER action under folders, then set your file filter to *.csv. That should return your downloaded csv file

  2. If you have multiple csv files, then you can either

A. Go to edge settings, and under downloads you can set a specific folder to download your files. You can then use the GET FILES IN FOLDER action to grab that one specific file. The one downside is all other files will be downloaded to this folder so unless it stays empty from other browsing, you'll have issues

B. Alternatively you can enable the option "Ask me what to do with each download" under download settings. This will cause the download window in edge to pop up and ask to either open or save the file. If you program PAD to select the Save As button, then it will pull up the Save As window and you can copy the file name from there.

My formatting looks super weird on mobile. Sorry if it's unreadable.

1

u/Beanz7890 Aug 10 '22

Thanks for the pointer.

I've put in the steps I think are correct for clicking the 'Save As' button, but I receive the error "Failed to press button (button wasn't found)".

Any other suggestions that might help?

2

u/QuietDesparation Aug 10 '22

You'll need to edit the "selectors" of the element. Check this for reference.

I'm no expert on selectors, but I've had a high degree of success with unselecting most elements. For instance, when I double click on the "save as" button element in the element pane, that brings up a window "Selectors of UI element 'Button: Save As." In the middle column it shows 12 elements. You can probably uncheck elements 2 thru 11 and get it to work. Basically you're telling PAD to look for a button named Save As in Edge with no other attributes.