The following code sets up selenium with chromedriver:
import os
import selenium
print(selenium.__version__)
url = 'https://home.treasury.gov/policy-issues/financing-the-government/interest-rate-statistics'
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
options = Options()
options.add_argument('--headless')
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get(url)
And this code attempts to download a file:
nominal = driver.find_element(By.LINK_TEXT, 'DAILY TREASURY PAR YIELD CURVE RATES')
nominal.click()
dwnld = driver.find_element(By.LINK_TEXT, 'Download CSV')
dwnld.click()
It works perfectly on Linux but not on Windows. Selenium version is 4.0.0 on Linux and 4.1.2 on Windows.
On Linux it downloads to the current directory of the python process. On Windows, I looked in several places but could not find a downloaded file.
What is going on? Is there a way to find out the directory that selenium downloads into?