I like to save the download file to the specific location on my drive e.g D:\ but after running my Python with Selenium code, it returns "Failed - Download error" and more information from Chrome to fix the error are :
Internet connection
Download later
contact web site owner
Following are the codes that I have:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_experimental_option("prefs", {"download.default_directory":r"D:/"})
s = Service('chromedriver.exe')
driver = webdriver.Chrome(service=s, options=options)
driver.get("http://www.aastocks.com/tc/stocks/market/high-low-stocks.aspx?catg=1&period=3&t=1")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CLASS_NAME, "ts2_icon_excel"))).click()
It returns the Failed - Download error.
Any suggestion ?