I have read these QA :
Downloading file to specified location with Selenium and python
Access to file download dialog in Firefox
and this blog : Working with file download in Python Selenium WebDriver
I then executed this code to specify the right path for the download:
from selenium import webdriver
my_path = r'C\some_dir\where_I\want_to\store\the_downloads'
profile = webdriver.FirefoxProfile()
profile.set_preference("brower.download.foldeList", 2)
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.download.dir", my_path)
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/csv/pdf")
driver = webdriver.Firefox(executable_path=driver_path, firefox_profile=profile)
My issue is that the documents are not saved in my_path
but in the default download directory of firefox.
EDIT 1:
I am unable to change the browser.download.folderList
parameter.
Here is my command:
profile.set_preference('brower.download.folderList', '2')
I also tried each of these:
profile.set_preference('brower.download.folderList', 2)
profile.set_preference("brower.download.folderList", '2')
profile.set_preference("brower.download.folderList", 2)
When I open the about:config
page on the opened Firefow window, brower.download.folderList
is set to 1
.