码迷,mamicode.com
首页 > 编程语言 > 详细

python+selenium下载文件——Chrome

时间:2019-12-22 22:59:15      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:nta   下载文件   set   下载   div   test   设置   quit   chrome   

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()

python+selenium下载文件——Chrome

标签:nta   下载文件   set   下载   div   test   设置   quit   chrome   

原文地址:https://www.cnblogs.com/xiaobaibailongma/p/12081505.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!