How Do I Download a PDF from a Web Page?

Im not sure how to ask this intelligently so please be gentle!
My scenario is running daily reports from a web based platform.
Having the source of the reports be web based Im constantly having to adjust the macro because the web site will do an update and some element on a page with shift a few pixels or something. So I am trying to move away from image based verification of anything in my macro. (I am a beginner in all of this so image based verification is my jam because i actually know what an image is!)

The biggest issue right now is downloading a pdf generated in chrome. In the pictures I uploaded you'll see what i hope is a self explanatory rundown of my issue. I am hoping that someone can help me find a better way of getting that report to download, maybe using java or something where I can side step the pop-up issue. Every day 5 years of separate monthly reports like that have to be run and the pdf report downloaded. All that to say that each pdf will be different if that matters at all.

Right now I am "right clicking" and moving the mouse to a picture of "save as" and then having the mouse click that to get the report to download, but I would love to find something more along the lines of the "click browser link" stuff that doesn't include any mouse movements or depend on any image verification.
I included the "inspect" info from Chrome for both the pdf report and the download button if that helps at all.
If any of this makes sense and someone is able to help me - honestly I will probably shed many tears of the purest of joy that has ever existed in the history of the world. Luckily you won't be able to see that happening as I'm pretty sure it would make both of us quite uncomfortable but it'll be going down nonetheless. Ive spent days and days trying to get this to work so my wife doesn't have to do run these reports each night (it takes hours) and I am failing miserably!
Thank you thank you thank you for reading through all this and for offering any advice you can!

Ryan, thanks for posting all the detailed images, that is very helpful.
What we need now is the actual HTML code for the two pages you're dealing with.
Looks like you know your way around the Chrome Dev Tools (via "inspect"), but JIC here's how you can copy all of the HTML for each page an post here:


And then paste into a Forum reply using the Forum Code Block,
with "html" as the language.

Then we should be able to use the HTML to create and test a Execute a JavaScript in Browser action that will download the PDFs.


Ryan, welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, its Forum is one of the best and friendliest forums on the Internet. Whenever you reach a tough stumbling block trying to use KM, please feel free to post your question/problem here for help.

You will also find this helpful:
Tip: How Do I Get The Best Answer in the Shortest Time?

Getting Started with Keyboard Maestro

For more help, see Getting Started with Keyboard Maestro and the Forum .


JMichael awww ok, thank you so much! To be honest, I have no idea what I am doing in the dev tools lol, I bought a web design course online like 3 years ago to start trying to learn and haven't finished them yet, Im gonna start them again tomorrow along with my exercising :lying_face: hahaha. Thank you so much for taking the time to help me out with this, I feel incredibly grateful.

I tried to paste the html like you said and its saying that I can't post because I am exceeding the character limit of 32000! Apparently just 1 page is over 52000 characters?!

There is 1200+ lines of code for just 1 page. Am I doing something wrong?
I used your macro to upload the html.
and wow, your macro is awesome! if I can get to that level of macro writing I don't know what Id do with myself lol!

Nope, I should have thought of that.
Best thing to do now is save the web page as html, and then zip both files into one zip file. Then just drag the zip file into a Forum reply.