下载时,chrome提示的安全警告去除和设置下载目录 Selenium 3.6.0 chromedriver 2.33 Google Chrome 62.0.3202.62 (Official Build) (64-bit) And it works: from selenium import webdriver download_dir = "/pathToDownloadDir" chrome_options = webdriver.ChromeOptions() preferences = {"download.default_directory": download_dir , "directory_upgrade": True, "safebrowsing.enabled": True } chrome_options.add_experimental_option("prefs", preferences) driver = webdriver.Chrome(chrome_options=chrome_options,executable_path=r'/pathTo/chromedriver') driver.get("urlFileToDownload");
主要是:"safebrowsing.enabled": True参数。增加了这个参数。就不会弹出保存与放弃的提示;
实际效果已测试,可以使用。