【Selenium】webdriver.ChromeOptions()官方文档参数

Google官方Chrome文档,在此记录一下

Chrome Flags for Tooling

Many tools maintain a list of runtime flags for Chrome to configure the environment. This file
is an attempt to document all chrome flags that are relevant to tools, automation, benchmarking, etc.

All use cases are different, so you’ll have to choose which flags are most appropriate.

Here’s a Nov 2022 comparison of what flags all these tools use.

Commonly unwanted browser features

  • --disable-client-side-phishing-detection: Disables client-side phishing detection
  • --disable-component-extensions-with-background-pages: Disable some built-in extensions that aren’t affected by --disable-extensions
  • --disable-default-apps: Disable installation of default apps
  • --disable-extensions: Disable all chrome extensions
  • --disable-features=InterestFeedContentSuggestions: Disables the Discover feed on NTP
  • --disable-features=Translate: Disables Chrome translation, both the manual option and the popup prompt when a page with differing language is detected.
  • --hide-scrollbars: Hide scrollbars from screenshots.
  • --mute-audio: Mute any audio
  • --no-default-browser-check: Disable the default browser check, do not prompt to set it as such
  • --no-first-run: Skip first run wizards

Task throttling

  • --disable-background-timer-throttling: Disable timers being throttled in background pages/tabs
  • --disable-backgrounding-occluded-windows: Normally, Chrome will treat a ‘foreground’ tab instead as backgrounded if the surrounding window is occluded (aka visually covered) by another window. This flag disables that.
  • --disable-features=CalculateNativeWinOcclusion: Disable the feature of: Calculate window occlusion on Windows will be used in the future to throttle and potentially unload foreground tabs in occluded windows.
  • --disable-hang-monitor: Suppresses hang monitor dialogs in renderer processes. This flag may allow slow unload handlers on a page to prevent the tab from closing.
  • --disable-ipc-flooding-protection: Some javascript functions can be used to flood the browser process with IPC. By default, protection is on to limit the number of IPC sent to 10 per second per frame. This flag disables it. https://crrev.com/604305
  • --disable-renderer-backgrounding: This disables non-foreground tabs from getting a lower process priority This doesn’t (on its own) affect timers or painting behavior. karma-chrome-launcher#123

Web platform behavior

  • --aggressive-cache-discard
  • --allow-running-insecure-content
  • --disable-back-forward-cache: Disables the BackForwardCache feature.
  • --disable-features=AcceptCHFrame: Disable accepting h2/h3 ACCEPT_CH Client Hints frames.
  • --disable-features=AutoExpandDetailsElement: Removed in Sept 2022.
  • --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync: If enabled, this feature results in the browser process only asking the renderer process to run beforeunload handlers if it knows such handlers are registered. With kAvoidUnnecessaryBeforeUnloadCheckSync, content does not report a beforeunload handler is present. A ramification of this is navigations that would normally check beforeunload handlers before continuing will not, and navigation will synchronously continue.
  • --disable-features=BackForwardCache: Disable the bfcache.
  • --disable-features=HeavyAdPrivacyMitigations: Disables the privacy mitigations for the heavy ad intervention. This throttles the amount of interventions that can occur on a given host in a time period. It also adds noise to the thresholds used. This is separate from the intervention feature so it does not interfere with field trial activation, as this blocklist is created for every user, and noise is decided prior to seeing a heavy ad.
  • --disable-features=IsolateOrigins
  • --disable-features=LazyFrameLoading
  • --disable-features=ScriptStreaming: V8 script streaming
  • --enable-precise-memory-info: Make the values returned to window.performance.memory more granular and more up to date in shared worker. Without this flag, the memory information is still available, but it is bucketized and updated less frequently. This flag also applys to workers.
  • --js-flags=--random-seed=1157259157: Initialize V8’s RNG with a fixed seed.
  • --use-fake-device-for-media-stream: Use fake device for Media Stream to replace camera and microphone
  • --use-fake-ui-for-media-stream: Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). Works with --use-fake-device-for-media-stream.
  • --use-file-for-fake-video-capture=<path-to-file>: Use file for fake video capture (.y4m or .mjpeg) Needs --use-fake-device-for-media-stream

Interactivity suppression

  • --autoplay-policy=...: Value of user-gesture-required to not autoplay video. Value of no-user-gesture-required to always autoplay video.
  • --deny-permission-prompts: Suppress all permission prompts by automatically denying them.
  • --disable-external-intent-requests: Disallow opening links in external applications
  • --disable-features=GlobalMediaControls: Hide toolbar button that opens dialog for controlling media sessions.
  • --disable-features=ImprovedCookieControls: Disables an improved UI for third-party cookie blocking in incognito mode.
  • --disable-notifications: Disables the Web Notification and the Push APIs.
  • --disable-popup-blocking: Disable popup blocking. --block-new-web-contents is the strict version of this.
  • --disable-prompt-on-repost: Reloading a page that came from a POST normally prompts the user.
  • --noerrdialogs: Suppresses all error dialogs when present.

Catch-all automation

  • --enable-automation: Disable a few things considered not appropriate for automation. (Original design doc, though renamed here) codesearch. Note that some projects have chosen to avoid using this flag: web-platform-tests/wpt/#6348, crbug.com/1277272
    • sets window.navigator.webdriver to true within all JS contexts. This is also set when using --headless, --remote-debugging-pipe and --remote-debugging-port=0 (yes, specifically 0).
    • disables bubble notification about running development/unpacked extensions (source)
    • disables the password saving UI (which covers the usecase of the defunct --disable-save-password-bubble flag)
    • disables infobar animations (source)
    • disables auto-reloading on network errors (source)
    • enables the CDP method Browser.getBrowserCommandLine.
    • avoids showing these 4 infobars: ShowBadFlagsPrompt, GoogleApiKeysInfoBarDelegate, ObsoleteSystemInfoBarDelegate, LacrosButterBar
    • adds this infobar: image … which is known to adversely affect screenshots.
  • --test-type: Basically the 2014 version of --enable-automation. codesearch
    • It avoids creating application stubs in ~/Applications on mac.
    • It makes exit codes slightly more correct
    • windows navigation jumplists arent updated https://crbug.com/389375
    • doesn’t start some chrome StartPageService
    • disables initializing chromecast service
    • “Component extensions with background pages are not enabled during tests because they generate a lot of background behavior that can interfere.”
    • when quitting the browser, it disables additional checks that may stop that quitting process. (like unsaved form modifications or unhandled profile notifications…)
  • --remote-debugging-pipe: more secure than using protocol over a websocket
  • --remote-debugging-port=...: With a value of 0, Chrome will automatically select a useable port and will set navigator.webdriver to true.
  • --silent-debugger-extension-api: Does not show an infobar when a Chrome extension attaches to a page using chrome.debugger page. Required to attach to extension background pages.

General

  • --enable-logging=stderr: Logging behavior slightly more appropriate for a server-type process.
  • --log-level=0: 0 means INFO and higher. 2 is the most verbose. Protip: Use --enable-logging=stderr --v=2 and you may spot additional components active that you may want to disable.
  • --user-data-dir=...: Directory where the browser stores the user profile.

Chromium Annoyances

  • --disable-features=DialMediaRouteProvider: Avoid the startup dialog for Do you want the application “Chromium.app” to accept incoming network connections?. This is a sub-component of the MediaRouter.
  • --password-store=basic: Avoid potential instability of using Gnome Keyring or KDE wallet. chromium/linux/password_storage.md https://crbug.com/571003
  • --use-mock-keychain: Use mock keychain on Mac to prevent the blocking permissions dialog abou: Chrome wants to use your confidential information stored in your keychain

Background networking

  • --disable-background-networking: Disable various background network services, including extension updating,safe browsing service, upgrade detector, translate, UMA
  • --disable-breakpad: Disable crashdump collection (reporting is already disabled in Chromium)
  • --disable-component-update: Don’t update the browser ‘components’ listed at chrome://components/
  • --disable-domain-reliability: Disables Domain Reliability Monitoring, which tracks whether the browser has difficulty contacting Google-owned sites and uploads reports to Google.
  • --disable-features=AutofillServerCommunication: Disables (mostly for hermetic testing) autofill server communication. The URL of the autofill server can further be controlled via the autofill-server-url param. The given URL should specify the complete autofill server API url up to the parent “directory” of the “query” and “upload” resources. i.e., https://other.autofill.server:port/tbproxy/af/
  • --disable-features=CertificateTransparencyComponentUpdater
  • --disable-sync: Disable syncing to a Google account
  • --enable-crash-reporter-for-testing: Used for turning on Breakpad crash reporting in a debug environment where crash reporting is typically compiled but disabled.
  • --metrics-recording-only: Disable reporting to UMA, but allows for collection
  • --disable-features=OptimizationHints: Disable the Chrome Optimization Guide and networking with its service API
  • --disable-features=MediaRouter: Disable the Chrome Media Router which creates some background network activity to discover castable targets.
  • --no-pings: Don’t send hyperlink auditing pings

Rendering & GPU

  • --allow-pre-commit-input: Allows processing of input before a frame has been committed. Used by headless. https://crbug.com/987626
  • --deterministic-mode: An experimental meta flag. This sets the below indented flags which put the browser into a mode where rendering (border radius, etc) is deterministic and begin frames should be issued over DevTools Protocol. codesearch
    • --run-all-compositor-stages-before-draw
    • --disable-new-content-rendering-timeout
    • --enable-begin-frame-control
    • --disable-threaded-animation
    • --disable-threaded-scrolling
    • --disable-checker-imaging
    • --disable-image-animation-resync
  • --disable-features=PaintHolding: Don’t defer paint commits (normally used to avoid flash of unstyled content)
  • --disable-partial-raster: https://crbug.com/919955
  • --disable-skia-runtime-opts: Do not use runtime-detected high-end CPU optimizations in Skia.
  • --in-process-gpu: Saves some memory by moving GPU process into a browser process thread
  • --use-gl="swiftshader": Select which implementation of GL the GPU process should use. Options are: desktop: whatever desktop OpenGL the user has installed (Linux and Mac default). egl: whatever EGL / GLES2 the user has installed (Windows default - actually ANGLE). swiftshader: The SwiftShader software renderer.

Window & screen management

  • --block-new-web-contents: All pop-ups and calls to window.open will fail.
  • --force-color-profile=srgb: Force all monitors to be treated as though they have the specified color profile.
  • --new-window: Launches URL in new browser window.
  • --window-position=0,0: Specify the initial window position: --window-position=x,y
  • --window-size=1600,1024: Sets the initial window size. Provided as string in the format “800,600”.

Process management

  • --disable-features=DestroyProfileOnBrowserClose: Disable the feature of: Destroy profiles when their last browser window is closed, instead of when the browser exits.
  • --disable-features=site-per-process: Disables OOPIF. https://www.chromium.org/Home/chromium-security/site-isolation
  • --no-service-autorun: Disables the service process from adding itself as an autorun process. This does not delete existing autorun registrations, it just prevents the service from registering a new one.
  • --process-per-tab: Doesn’t do anything. Use --single-process instead.
  • --single-process: Runs the renderer and plugins in the same process as the browser.

Headless

  • --headless: Run in headless mode, i.e., without a UI or display server dependencies.
  • --headless=new: New, native Headless mode. (previously, --headless=chrome)
  • --no-sandbox: Sometimes used with headless, though not recommended.
  • --disable-dev-shm-usage: Often used in Lambda, Cloud Functions scenarios. (pptr issue, crbug)
  • --disable-gpu: Was often used along with --headless, but as of 2021, isn’t needed.

Removed flags

  • --disable-add-to-shelf: Removed June 2017
  • --disable-background-downloads: Removed Oct 2014.
  • --disable-browser-side-navigation: Removed. It disabled PlzNavigate.
  • --disable-datasaver-prompt: Removed
  • --disable-desktop-notifications: Removed
  • --disable-device-discovery-notifications: Removed. Avoided messages like “New printer on your network”. Replaced with --disable-features=MediaRouter.
  • --disable-features=TranslateUI: Removed as TranslateUI changed to Translate in Sept 2020.
  • --disable-infobars: Removed April 2014
  • --disable-save-password-bubble: Removed May 2016
  • --disable-search-geolocation-disclosure: Removed.
  • --disable-translate: Removed April 2017 Used to disable built-in Google Translate service.
  • --ignore-autoplay-restrictions: Removed December 2017 Can use --autoplay-policy=no-user-gesture-required instead.
  • --safebrowsing-disable-auto-update: Removed Nov 2017

Sources

  • chrome-launcher’s flags
  • Chromedriver’s flags
  • Puppeteer’s flags
  • WebpageTest’s flags
  • Catapult’s flags and here
  • Karma’s flags

The canonical list of Chrome command-line switches on peter.sh (maintained by the Chromium team)

FYI: (Probably) all flags are defined in files matching the pattern of *_switches.cc.

Set Preferences

Many Chrome settings are defined in a JSON file located at USER_DATA_DIR/Default/Preferences. Browse your own Preferences file to see what’s in there; some, but not all, preferences are defined in pref_names.h

If you wanted to launch a fresh Chrome profile with some Preferences set, for example: disable DevTools source-map fetching:

mkdir -p your_empty_user_data_dir/Default/
echo '{"devtools":{"preferences":{"jsSourceMapsEnabled":"false","cssSourceMapsEnabled":"false"}}}' > your_empty_user_data_dir/Default/Preferenceschrome --user-data-dir=your_empty_user_data_dir ...

Feature Flags FYI

Chromium and Blink use feature flags to disable/enable many features at runtime. Chromium has ~400 features that can be toggled with --enable-features / --disable-features. https://niek.github.io/chrome-features/ presents all of them very clearly.

Independently, Blink has many features that can be toggled with commandline switches: --enable-blink-features / --disable-blink-features.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/134199.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

竞赛 基于机器视觉的行人口罩佩戴检测

简介 2020新冠爆发以来&#xff0c;疫情牵动着全国人民的心&#xff0c;一线医护工作者在最前线抗击疫情的同时&#xff0c;我们也可以看到很多科技行业和人工智能领域的从业者&#xff0c;也在贡献着他们的力量。近些天来&#xff0c;旷视、商汤、海康、百度都多家科技公司研…

红外检漏技术

SF6气体绝缘设备发生泄漏后会造成运行开关闭锁、 内部绝缘击穿&#xff0c; 泄漏到空气中会造成环境污染&#xff0c; 并严重危害现场人员安全。 再加之SF6气体成本高&#xff0c; 频繁补气&#xff0c; 使维护成本增加&#xff0c; 造成经济损失。 红外检漏是依据SF6气体对红外…

EasyUI combobox 实现搜索(模糊匹配)功能

很简单的一个下拉框搜索模糊匹配功能&#xff0c;在此记录&#xff1a; 1&#xff1a;页面实现&#xff1a; <select class"easyui-combobox" name"combobox" id"combobox" style"width:135px;height:25px;" headerValue"请选…

LeetCode142.环形链表-II

这道题和上一道题几乎没有任何区别啊&#xff0c;为什么还是中等难度&#xff0c;我用上一道题的解法一分钟就写出来了&#xff0c;只不过返回的不是true和false而是节点&#xff0c;以下是我的代码&#xff1a; public class Solution {public ListNode detectCycle(ListNode…

推荐一款负载均衡器,助你轻松管理多个 Socks5 代理

推荐一款负载均衡器&#xff0c;助你轻松管理多个 Socks5 代理。 推荐一个 GitHub 开源项目 mingcheng/socks5lb&#xff0c;该项目在 GitHub 有超过 400 Star&#xff0c;用一句话介绍该项目就是&#xff1a;“A simple socks5 proxy load balance and transparent proxy”&a…

1131. 绝对值表达式的最大值

1131. 绝对值表达式的最大值 原题链接&#xff1a;完成情况&#xff1a;解题思路&#xff1a;求方向一次遍历两度统计 参考代码&#xff1a;求方向一次遍历两度统计 原题链接&#xff1a; 1131. 绝对值表达式的最大值 https://leetcode.cn/problems/maximum-of-absolute-val…

【CCF】第30次csp认证——202305-1重复局面

202305-1重复局面&#xff1a; 问题描述 国际象棋每一个局面可以用大小为 88 的字符数组来表示&#xff0c;其中每一位对应棋盘上的一个格子。六种棋子王、后、车、象、马、兵分别用字母 k、q、r、b、n、p 表示&#xff0c;其中大写字母对应白方、小写字母对应黑方。棋盘上无…

iOS开发之编译OpenSSL静态库

项目审查发现OpenSSL1.0.2d有漏洞&#xff0c;所以需要升级更新OpenSSL版本&#xff0c;借此机会&#xff0c;记录一下编译OpenSSL静态库的流程。 Xcode使用的是14.2&#xff0c;OpenSSL使用的是1.0.2u、1.1.1u&#xff0c;由于是对两个不同版本进行的编译操作&#xff0c;所以…

Linux下安装和使用MySQL的详细教程

✅作者简介&#xff1a;2022年博客新星 第八。热爱国学的Java后端开发者&#xff0c;修心和技术同步精进。 &#x1f34e;个人主页&#xff1a;Java Fans的博客 &#x1f34a;个人信条&#xff1a;不迁怒&#xff0c;不贰过。小知识&#xff0c;大智慧。 &#x1f49e;当前专栏…

js中如何获取当前页面的URL参数值?

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ 获取当前页面的URL参数值⭐ 解析查询字符串⭐ 使用正则表达式解析参数值⭐ 写在最后 ⭐ 专栏简介 前端入门之旅&#xff1a;探索Web开发的奇妙世界 记得点击上方或者右侧链接订阅本专栏哦 几何带你启航前端之旅 欢迎来到前端入门之旅&am…

LC142. 环形链表 II

题目大意 给你一个链表&#xff0c;要求判断是否有环&#xff0c;若有环&#xff0c;找出环的入口结点。 142. 环形链表 II 判断是否有环 判环比较简单&#xff0c;用一个一次走一个结点的快指针&#xff0c;和一个一次走一个结点的慢指针同时遍历链表&#xff0c;若两指针相…

第一颗国产 单/双端口 MIPI CSI/DSI 至 HDMI 1.4 发射器 芯片LT9611

1. 描述 LT9611 MIPI DSI/CSI 至 HDMI1.4 桥接器具有双端口 MIPI D-PHY 接收器前端配置&#xff0c;每个端口有 4 个数据通道&#xff0c;每个数据通道以 2Gbps 的速度工作&#xff0c;最大输入带宽为 16Gbps。 该桥接器提供一个 HDMI 数据输出&#xff0c;具有可选的 …

8位和32位单片机如何选择适合,以及主要区别!

单片机直接影响到项目的成功和性能&#xff0c;我们将分享如何选择适合您的应用的8位或32位单片机。 8位单片机 vs. 32位单片机&#xff1a; 一、性能和处理能力&#xff1a; 8位单片机&#xff1a; 8位单片机通常适用于相对简单的应用&#xff0c;如传感器控制、LED显示、小…

【论文笔记】Perception, Planning, Control, and Coordination for Autonomous Vehicles

单纯作为阅读笔记&#xff0c;文章内容可能有些混乱。 文章目录 1. Introduction2. Perception3. Planning3.1. Autonomous Vehicle Planning Systems3.2. Mission Planning3.3. Behavioral Planning3.4. Motion Planning3.4.1. Combinatorial Planning3.4.2. Sampling-Based P…

JavaWeb基础学习(5)

JavaWeb基础学习 一、Filter1.1 Filter介绍1.2 Filter快速入门1.3、Filter执行流程1.4、Filter使用细节1.5、Filter-案例-登陆验证 二、Listener2.1 Listener介绍2.2、ServletContextListener使用 三、AJAX3.1 AJAX介绍与概念3.2 AJAX快速入门3.3 Axios异步架构3.4 JSON-概述和…

[管理与领导-96]:IT基层管理者 - 扩展技能 - 5 - 职场丛林法则 -10- 七分做,三分讲,完整汇报工作的艺术

目录 前言&#xff1a; 一、汇报工作的重要性 1.1 汇报的重要性&#xff1a;汇报工作是工作重要的一环 1.2 向上司汇报工作状态具有重要的意义 1.2 汇报工作存在一些误解 1.3 汇报工作中的下错误做法 1.4 汇报工作与做实际工作的关系 二、工作汇报的内容与艺术 2.1 工…

Hugging Face使用Stable diffusion Diffusers Transformers Accelerate Pipelines

Diffusers A library that offers an implementation of various diffusion models, including text-to-image models. 提供不同扩散模型的实现的库&#xff0c;代码上最简洁&#xff0c;国内的问题是 huggingface 需要翻墙。 Transformers A Hugging Face library that pr…

Ubuntu安装深度学习环境相关(yolov8-python部署)

Ubuntu安装深度学习环境相关(yolov8-python部署) 本文将从如下几个方面总结相关的工作过程&#xff1a; Ubuntu系统安装(联想小新pro16) 2.显卡驱动安装3.测试深度学习模型 1. Ubunut 系统安装 之前在台式机上安装过Ubuntu&#xff0c;以为再在笔记本上安装会是小菜一碟&…

C: . 与 -> 的区别

相同点&#xff1a; 功能相同&#xff1a;访问结构体或者类的成员。优先级相同。 不同点&#xff1a; 结构体变量用 . 来访问成员&#xff1b;结构体指针用 ->来访问成员&#xff1b; #include <stdio.h> #include<string.h> //首先定义结构体类型student&a…

查询IP地址可得到哪些信息

通过IP地址定位&#xff0c;可以获取一些基本的信息&#xff0c;包括以下内容&#xff1a; 1. 地理位置&#xff1a;你可以确定IP地址所在的地理位置&#xff0c;包括国家、州或省、城市和地理坐标。这通常是通过将IP地址与地理位置数据库进行匹配来实现的。 2. ISP&#xff…