I have a URL that takes me directly to a pdf. I would like to automatically download that file. Below is my sample code.
from selenium import webdriver
chromedriver ="//Server/Apps/chrome_driver/chromedriver.exe"
download_dir = "C:\\Temp\\Download"
driver = webdriver.Chrome(chromedriver)
driver.implicitly_wait(15)
options = webdriver.chrome.options.Options()
profile = {"plugins.plugins_list": [{"enabled": False, "name": "Chrome PDF Viewer"}], # Disable Chrome's PDF Viewer
"download.default_directory": download_dir , "download.extensions_to_open": "application/pdf"}
options.add_experimental_option("prefs", profile)
driver.get('
https://www.troweprice.com/content/dam/trowecorp/Pdfs/TRPIL%20MiFID%20II%20Execution%20Quality%20Report%202017.pdf ')