I've read and tested many solutions but none of them worked. I'm automating tweeter post: I write my tweet, works fine, and then, I click on the Add Pic button ; the windows open file dialog box pops up. I want to change the directory. Here's my actual code:
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\Jake\\AppData\\Local\\Google\\Chrome\\User Data\\Default")
prefs = {"download.default_directory" : "E:\\Images\\tweeter\\","directory_upgrade": True,"extensions_to_open": ""}
options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(executable_path='C:\\Program Files (x86)\\chromedriver.exe', chrome_options=options)
Doesn't work.
Other solution found elsewhere:
options.add_argument("download.default_directory=E:\\Images\\tweeter\\")
Doesn't work.
Other one:
prefs = {"profile.default_content_settings.popups": 0,
"download.default_directory":
r"E:\Images\tweeter\\",#IMPORTANT - ENDING SLASH V IMPORTANT
"directory_upgrade": True}
options.add_experimental_option("prefs", prefs)
Doesn't work.
Any idea?