记号一下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
随机推荐
- tcpkill,干掉tcp连接
场景 当我们需要在不重启服务的情况下断开某一个TCP长连接时,tcpkill工具就非常有用.比如我们要测试某个长连接断开后程序自动重连的情况. tcpkill安装 这个连接的作者改了一下tcpkill ...
- JDBC ---获取数据字段 -- 转成map
getConn = JdbcDataBaseUtil.getConnection(user,pwd,serverUrl,mysqDriver); //建立一个结果集,用来保存查询出来的结果 Resul ...
- Vue.js学习使用心得(四)——组件
一.组件 组件(Component)是 Vue.js 最强大的功能之一. 组件可以扩展 HTML 元素,封装可重用的代码. 组件系统让我们可以用独立可复用的小组件来构建大型应用,几乎任意类型的应用的界 ...
- Web.xml详解分析
一.首先了解项目加载的优先级 首先可以肯定的是,加载顺序与它们在 web.xml 文件中的先后顺序无关.即不会因为 filter 写在 listener 的前面而会先加载 filter. 最终得出的结 ...
- smartgit的安装
smartgit是非常好用的一个图形化git工具,有Ubuntu版本的,直接去官网下载即可,但使用smartgit要求先jre. 直接去官网上下载jre:https://www.java.com/zh ...
- poj2279——Mr. Young's Picture Permutations
Description Mr. Young wishes to take a picture of his class. The students will stand in rows with ea ...
- gitlab部署步骤+汉化
系统环境centos7 下载gitlab安装包 https://packages.gitlab.com/gitlab/gitlab-ce 我下载的版本是 gitlab-ce-11.1.4-ce.0.e ...
- Python脚本模拟僵尸进程与孤儿进程
最近一台机器的systemd内存高达30%多,一直不变,后来排查是僵尸进程,什么是僵尸进程呢,只能google,百度等先了解,然后自己总结了一下,虽然这是基础的东西,但是对于我来说就如新大陆一样.花了 ...
- [转]Java泛型
一. 泛型概念的提出(为什么需要泛型)? 首先,我们看下下面这段简短的代码: 1 public class GenericTest { 2 3 public static void main(Stri ...
- ubuntu18关闭系统自动更新
ubuntu18.04关闭系统自动更新有两个方法:1.修改配置文件 修改配置文件/etc/apt/apt.conf.d/10periodic#0是关闭,1是开启,将所有值改为0vi etc/apt/a ...