How to click on a website download button using Powershell-ElementID changes

Hello All,

This may be a bit of an advanced topic/question but I am trying to figure out how to click on a download button on a website but the issue is the elementID changes based on the file name each time. I also need to figure out how to do this for more than 1 file and then lastly how to save as to my download folder when that question pops up. I have made great progress getting to the download button. I hope to insert 3 images here to show the issue-source code and the webpage with the blue download button, the save as image, and my powershell commands so far to get there. Thank you for any pointers/ideas/assistance as I am still learning how to do website commands in powershell.Download button infoMore info for saving fileMy code so far

ccgll0152, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

When you post code, error messages, sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE“, in the “Visual” view you can use the format template “Preformatted“. You can go back edit your post and fix the formatting – you don’t have to create a new one.
Thanks in advance.

(body)
    (div id='div1')Blah(/div)
    
    (div id='div2')
        (div id='buttons')
            (button type="button")Download(/button)
        (/div)
    (/div)   

(/body)

The best you can do is try to narrow the objects down. For instance, you could GetElementById(‘div2’), then GetElementByTagName(‘button’) and then foreach $_.Click()