I'm using Selenium in Python and I'm trying to change the download path. But either this:
prefs = {"download.default_directory": "C:\\Users\\personal\\Downloads\\exports"}
options.add_experimental_option("prefs", prefs)`
or this
options.add_argument("--download.default_directory --C:\\Users\\personal\\Downloads\exports")`
are not working.
In first case I also get the error
from invalid argument: unrecognized chrome option: prefs
Can someone help?
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_experimental_option('excludeSwitches', ['enable-logging'])
prefs = {"profile.default_content_settings.popups": 0, "download.default_directory":r"C:\Users\xxxx\xxxx\ccc\xxxx\xx\xx", ### Set the path accordingly"download.prompt_for_download": False, ## change the downpath accordingly"download.directory_upgrade": True}
options.add_experimental_option("prefs", prefs)
driver = Chrome(service=Service(PATH), options=options)