i have the below code to convert simple web page to pdf and save it to a folder. My destination downloads folder is being ignored and it writes to defaults Downloads folder. Any help is appreciated.
from selenium import webdriver
import json
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--start-maximized")
settings = {
"recentDestinations": [{
"id": "Save as PDF",
"origin": "local",
"account": "",
}],
"selectedDestinationId": "Save as PDF",
"version": 2
}
prefs = {'printing.print_preview_sticky_settings.appState': json.dumps(settings)}
download_dir = "C:\\Users\\Testing\\GitHub\\Python\\downloads\\"
prefs2 = {"profile.default_content_settings.popups": 0,
"download.default_directory": download_dir,
# "default_directory": r"C:\Users\Testing\GitHub\Python\\",
"directory_upgrade": True,
"printing.print_preview_sticky_settings.appState": json.dumps(settings),
"download.extensions_to_open": "applications/pdf"
}
chrome_options.add_experimental_option("prefs",prefs2)
chrome_options.add_argument('--kiosk-printing')