python+selenium下载文件——Chrome 阳光穿透心脏的1/2处 2023-10-02 08:53 3阅读 0赞 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()
还没有评论,来说两句吧...