记号一下selenium+Firefox自动下载的参数
参考:
- https://blog.csdn.net/wxstar8/article/details/80782556
- https://blog.csdn.net/xiaoguanyusb/article/details/85016334
- https://www.cnblogs.com/cmnz/p/9093018.html
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.dir', temp_path) #现在文件存放的目录
# profile.set_preference('browser.download.folderList', 2)
# profile.set_preference('browser.download.manager.showWhenStarting', False)
# profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
profile.set_preference("profile.default_content_settings.popups", 0);
#将browser.download.folderList设置成2,表示将文件下载到指定路径
#设置成0表示下载到桌面;设置为1表示下载到默认路径
profile.set_preference('browser.download.folderList',2)
#browser.helpApps.alwaysAsk.force对于未知的MIME类型文件会弹出窗口
#让用户处理,默认值为True,设定为False表示不会记录打开未知MIME类型
#文件方式
profile.set_preference('browser.helpApps.alwaysAsk.force',False)
#在开始下载时是否显示下载管理器
profile.set_preference('browser.download.manager.showWhenStarting',False)
#设定为False会把下载框进行隐藏
profile.set_preference('browser.download.manager.useWindow',False)
#默认值为True设置为false表示不获取焦点
profile.set_preference('browser.download.manager.focusWhenStarting',False)
#下载exe文件弹出警告,默认值为True ,设置为False则不会弹出警告框
profile.set_preference('browser.download.manager.alertOnEXEOpen',False)
#browser.helperApps.neverAsk.openFile表示直接打开下载文件,不显示确认框
#默认值为空字符串,下行代码设定了多种文件的MIME类型
#例如 application/exe,表示.exe文件
#application/execl 表示Excel类型的文件
profile.set_preference('browser.helperApps.neverAsk.openFile',"application/pdf")
#对所给出的文件类型不在弹出提示框进行询问,直接保存在本地盘
profile.set_preference('browser.helperApps.neverAsk.saveToDisk','application/zip,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
#browser.download.manager.showAlertOnComplete设定下载文件结束后是否
#提示下载完成提示框
profile.set_preference('browser.download.manager.showAlertOnComplete',False)
#browser.download.manager.closeWhenDone 设定结束后是否自动关闭关闭下载框
#默认值是 True,设置为False表示不关闭下载管理器
profile.set_preference("browser.download.manager.closeWhenDone",False)
记号一下selenium+Firefox自动下载的参数的更多相关文章
- Python selenium 文件自动下载 (自动下载器)
MyGithub:https://github.com/williamzxl 最新代码已经上传到Github,以下版本为stupid版本. 由于在下载过程中需要下载不同文件,所以可以把所有类型放在Va ...
- Selenium 实现自动下载文件(FirefoxOptions,FirefoxProfile) - 根据Selenium Webdriver3实战宝典
Firefox 版本是72geckodriver 是 0.24selenium 是3.14 代码中注释有关于FirefoxOptions,FirefoxProfile的解释,请各位寻找一下,不做另外解 ...
- selenium下firefox自动下载配置及问题
在做自动化测试时,需要从网页上下载相关的文件到指定的目录,一直未能实现 网上正好有个blog文章介绍了如何下载 直接上代码: from selenium import webdriver import ...
- selenium实现自动下载文件
#coding:utf-8'''说明:导出'''from selenium import webdriverfrom public.highlightElement import highlightf ...
- Webdriver设置Firefox自动下载
看到很多人在firefox上操作下载窗口用autoit,太麻烦了,提供一种用profile来解决的办法: FirefoxProfile profile = new FirefoxProfile(); ...
- python使用selenium,webdriver自动下载百度网盘内容
想实现一个自动下载微信公众号分享百度网盘图片链接的爬虫,使用selenium和火狐的webdriver进行完成 1.首先根据自己的浏览器下载相应的webdriver驱动器,python中导入selen ...
- Selenium 设置浏览器下载 Firefox 和Chrome
当我们在使用Selenium运行自动化测试时,偶尔需要用到下载功能,但浏览器的下载可能会弹出下载窗口,或者下载路径不是我们想要保存的位置,所以在通过Selenium启动浏览器时需要做相关的设置,将使这 ...
- Selenium+Python:下载文件(Firefox 和 Chrome)
引自 https://blog.csdn.net/Momorrine/article/details/79794146 1. 环境 操作系统 Win10 IDE Eclipse (Oxyg ...
- Selenium Firefox 官方Webdriver -- Geckodriver 下载地址
Selenium Firefox 官方Webdriver -- Geckodriver 下载地址 https://github.com/mozilla/geckodriver/releases
随机推荐
- vscode 插件推荐 - 献给所有前端工程师(更新与2018.8.1)
VScode现在已经越来越完善.性能远超Atom和webstorm,你有什么理由不用它?在这里,我会给你们推荐很多实用的插件,让你对 vscode 有更深刻的体会,渐渐地你就会知道它有多好用. 走马观 ...
- single-cell RNA-seq 工具大全
[怪毛匠子-整理] awesome-single-cell List of software packages (and the people developing these methods) fo ...
- C++程序设计-面向对象
1-1面向对象初探 变量也是Object Data: the properties or status; is the core Operations: the functions对外能提供的服务, ...
- 日常遇错之ModuleNotFoundError: No module named request
用pycharm写python的时候,import request时,报错:ModuleNotFoundError: No module named request emmmm.解决方法:pip in ...
- SSL&TLS渗透测试
什么是TLS&SSL? 安全套接字层(SSL)和传输层安全(TLS)加密通过提供通信安全(传输加密)和为应用程序如网络.邮件.即时消息和某些虚拟私有网络(VPN)提供隐私的方式来确保互联网和网 ...
- redux进一步优化
1. 将原来的 mapStateToDispatch 中的函数提取出来,放在组件中, 如原来的: function mapStateToProps(state, ownProps) { retur ...
- socket资源
http://www.360doc.com/content/13/1231/16/14919052_341525862.shtml Linux下基于socket多线程并发通信的实现 https://w ...
- Django2.0资料
The Django Book 2.0 中文版:点击下载 Django课件和代码:点击下载
- HTTP Protocol - URI
Uniform Resource Identifier (URI): compact sequence of characters that identifies an abstract or phy ...
- jsp 进度条
<html> <head> <title>进度条</title> <style type="text/css"> ...