I am using Chrome/Chromedriver version: 93.0.4577 and Selenium version: 3.141.0 on Win 10. I'm trying to get Selenium to download PDF's without opening the file prompt.
I'm working with a work site unfortunately so I'm unable to share it but I've tried the libraries: urllib, request, as well as adjusting the chrome Options (which I'd like to use):
chrome_profile = webdriver.ChromeOptions()
profile = {"plugins.plugins_list": [{"enabled": False,
"name": "Chrome PDF Viewer"}],
"download.default_directory": "C:\\PDFDownload\\PDFs",
"download.prompt_for_download": False,
"download.directory_upgrade": True}
chrome_profile.add_experimental_option("prefs", profile)
driver = webdriver.Chrome(executable_path="C:\\Selenium\\chromedriver.exe",
chrome_options=chrome_profile)
I've also tried switching the chrome PDF site settings from 'Open PDFs in Chrome' to 'Download PDFs' when visiting them. However, everything still prompts me to save the file manually.
I feel like the chrome Options should be the winning ticket but it doesn't seem to have worked for me. Is there something I need to change/add in order to get past the pop up prompt?
I appreciate any advice, thank you!