selenium.webdriver中add_argument方法常用参数表
作者:WDC 时间:2023-12-05 13:39:38
我们在使用selenium库调用Chromedriver.exe时需要很多的配置参数下面列出了常用参数
chrome_options.add_argument("xxx")
序号 参数 说明
1 --allow-outdated-plugins 不停用过期的插件。
2 --allow-running-insecure-content 默认情况下,https 页面不允许从 http 链接引用 javascript/css/plug-ins。添加这一参数会放行这些内容。
3 --allow-scripting-gallery 允许拓展脚本在官方应用中心生效。默认情况下,出于安全因素考虑这些脚本都会被阻止。
4 --disable-accelerated-video 停用 GPU 加速视频。
5 --disable-dart 停用 Dart。
6 --disable-desktop-notifications 禁用桌面通知,在 Windows 中桌面通知默认是启用的。
7 --disable-extensions 禁用拓展。
8 --disable-file-system 停用 FileSystem API。
9 --disable-preconnect 停用 TCP/IP 预连接。
10 --disable-remote-fonts 关闭远程字体支持。SVG 中字体不受此参数影响。
11 --disable-speech-input 停用语音输入。
12 --disable-web-security 不遵守同源策略。
13 --disk-cache-dir 将缓存设置在给定的路径。
14 --disk-cache-size 设置缓存大小上限,以字节为单位。
15 --dns-prefetch-disable 停用DNS预读。
16 --enable-print-preview 启用打印预览。
17 --extensions-update-frequency 设定拓展自动更新频率,以秒为单位。
18 --incognito 让浏览器直接以隐身模式启动。
19 --keep-alive-for-test 最后一个标签关闭后仍保持浏览器进程。(某种意义上可以提高热启动速度,不过你最好得有充足的内存)
20 --kiosk 启用kiosk模式。(一种类似于全屏的浏览模式)
21 --lang 使用指定的语言。
22 --no-displaying-insecure-content 默认情况下,https 页面允许从 http 链接引用图片/字体/框架。添加这一参数会阻止这些内容。
23 --no-first-run 跳过 Chromium 首次运行检查。
24 --no-referrers 不发送 Http-Referer 头。
25 --no-sandbox 彻底停用沙箱。
26 --no-startup-window 启动时不建立窗口。
27 --proxy-pac-url 使用给定 URL 的 pac 代理脚本。(也可以使用本地文件,如 --proxy-pac-url="file:\\\c:\proxy.pac")
28 --proxy-server 使用给定的代理服务器,这个参数只对 http 和 https 有效。(例如 --proxy-server=127.0.0.1:8087 )
29 --single-process 以单进程模式运行 Chromium。(启动时浏览器会给出不安全警告)
30 --start-maximized 启动时最大化。
31 --user-agent 使用给定的 User-Agent 字符串
参数:--user-data-dir=UserDataDir
用途:自订使用者帐户资料夹(如:–user-data-dir="D:\temp\Chrome User Data")
参数:--process-per-tab
用途:每个分页使用单独进程
参数:--process-per-site
用途:每个站点使用单独进程
参数:--in-process-plugins
用途:插件不启用单独进程
参数:--disable-popup-blocking
用途:禁用弹出拦截
参数:--disable-javascript
用途:禁用JavaScript
参数:--disable-java
用途:禁用Java
参数:--disable-plugins
用途:禁用插件
参数:–disable-images
用途:禁用图像
参数:--omnibox-popup-count=”num”
用途:将网址列弹出的提示选单数量改为num个
参数:--enable-vertical-tabs
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
对python中执行DOS命令的3种方法总结
python实现web应用框架之增加响应对象
![](https://img.aspxhome.com/file/2023/5/124695_0s.webp)
python网络爬虫selenium打开多窗口与切换页面的实现
![](https://img.aspxhome.com/file/2023/7/133307_0s.png)
Python Pandas读写txt和csv文件的方法详解
![](https://img.aspxhome.com/file/2023/4/112594_0s.png)
Python伪随机数模块random详解
django用户注册、登录、注销和用户扩展的示例
![](https://img.aspxhome.com/file/2023/8/88888_0s.png)
使用PyInstaller将python转成可执行文件exe笔记
Pygame Transform图像变形的实现示例
基于python实现百度语音识别和图灵对话
![](https://img.aspxhome.com/file/2023/9/131229_0s.png)
ORACLE常见错误代码的分析与解决(三)
使用PyV8在Python爬虫中执行js代码
python爬虫开发之PyQuery模块详细使用方法与实例全解
mysql存储过程事务管理简析
Python 普通最小二乘法(OLS)进行多项式拟合的方法
![](https://img.aspxhome.com/file/2023/0/87800_0s.jpg)
Python多模块引用由此引发的相对路径混乱问题
![](https://img.aspxhome.com/file/2023/8/124388_0s.png)
在ASP.NET 2.0中操作数据之五十五:编辑和删除现有的二进制数据
![](https://img.aspxhome.com/file/2023/3/77173_0s.gif)
Flask框架学习笔记之模板操作实例详解
![](https://img.aspxhome.com/file/2023/8/95198_0s.png)
tensorflow 1.X迁移至tensorflow2 的代码写法
go常用指令之go mod详解
![](https://img.aspxhome.com/file/2023/4/134314_0s.png)