I'm working a program that will utilize Selenium/Webdriver to open a webpage, enter some data, and open a new page which is a PDF. Ultimately I would like to download that PDF into a folder. I know it is possible to download a PDF into a folder if you have the URL in your script, but I'm struggling to find a way to download it if it is opened within the program.
A) Is there a way to download a PDF that is opened explicitly in Chrome using a script? B) Is there a way to extract the URL from an opened webpage that then be fed back into the program to download from?