from selenium import webdriver import time options = webdriver.ChromeOptions() prefs = { 'profile.default_content_settings.popups':0 ,'download.default_directory':'C:\\Users\\del\\Desktop\\1'} #设置为0表示禁止弹出窗口, #设置文件下载路径 options.add_experimental_option('prefs',prefs) driver = webdriver.Chrome(chrome_options=options) driver.get("http://sahitest.com/demo/saveAs.htm") driver.find_element_by_link_text('testsaveas.zip').click() time.sleep(50) driver.quit()