I found the accepted solution didn’t work, however this slight change did:
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
prefs = {'download.default_directory' : '/path/to/dir'}
chrome_options.add_experimental_option('prefs', prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)
More Related Contents:
- How to open a Chrome Profile through Python
- WebDriverException: Message: ‘chromedriver’ executable needs to be in PATH while setting UserAgent through Selenium Chromedriver python
- How to use Chrome Profile in Selenium Webdriver Python 3
- WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome
- USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection error with ChromeDriver v87 / Chrome v87 using Selenium on Windows10
- Change ChromeOptions in an existing webdriver
- Selenium give file name when downloading
- Running Selenium WebDriver python bindings in chrome
- InvalidArgumentException: Message: invalid argument: user data directory is already in use error using –user-data-dir to start Chrome using Selenium
- Error Message: ‘chromedriver’ executable needs to be PATH
- Getting console.log output from Chrome with Selenium Python API bindings
- selenium.common.exceptions.WebDriverException: Message: invalid session id using Selenium with ChromeDriver and Chrome through Python
- Clicking on Get Data button for Monthly Settlement Statistics on nseindia.com doesn’t fetch results using Selenium and Python
- How to set window size in Selenium Chrome Python
- Downloading with chrome headless and selenium
- Download file through Google Chrome in headless mode
- Failed to read descriptor from node connection: A device attached to the system is not functioning error using ChromeDriver Selenium on Windows OS
- WebDriverException: Message: Service /usr/lib/chromium-browser/chromedriver unexpectedly exited on Raspberry-Pi with ChromeDriver and Selenium
- urllib3.exceptions.ProtocolError: (‘Connection aborted.’, error(10054, ‘An existing connection was forcibly closed by the remote host’))
- Selenium won’t open a new URL in a new tab (Python & Chrome)
- Set chrome browser binary through chromedriver in Python
- DeprecationWarning: use options instead of chrome_options error using ChromeDriver and Chrome through Selenium on Windows 10 system
- Chrome crashes after several hours while multiprocessing using Selenium through Python
- How to accept the popup presented when installing extension in Selenium?
- How to solve ‘Getting Default Adapter failed’ error when launching Chrome and try to access a webpage using the ChromeDriver using Selenium
- Why switching to alert through selenium is not stable?
- Chrome browser initiated through ChromeDriver gets detected
- WebDriverException: Service U:/Scraping/chromedriver.exe unexpectedly exited. Status code was: 1 while working with Chrome and Python
- selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable using Selenium
- Selenium can’t open a second page