当前位置:   article > 正文

Selenium Chrome的最全常用Option及其一些加速优化_selenium chrome options

selenium chrome options

一些加速优化

  1. chrome_options = Options()
  2. # chrome_options = webdriver.ChromeOptions()
  3. chrome_options.add_experimental_option("debuggerAddress", "xx.xx.xx.xx")
  4. # chrome_options.debugger_address = resp["data"]["ws"]["selenium"]
  5. # ---------------------------优化选项---------------------------------- #
  6. # 禁止图片
  7. chrome_options.add_argument('blink-settings=imagesEnabled=false')
  8. chrome_options.add_argument('--disable-images')
  9. # 禁用JavaScript
  10. chrome_options.add_argument("--disable-javascript")
  11. chrome_options.add_argument("--disable-plugins")
  12. chrome_options.add_argument('--disable-dev-shm-usage')
  13. chrome_options.add_argument('--disable-software-rasterizer')
  14. chrome_options.add_argument('--disable-extensions')
  15. chrome_options.add_argument('--disable-gpu')
  16. chrome_options.add_argument('--disable-java')
  17. chrome_options.add_argument('--no-sandbox')
  18. chrome_options.add_argument('--mute-audio')
  19. chrome_options.add_argument('--single-process')
  20. # 屏蔽webdriver特征
  21. chrome_options.add_argument("--disable-blink-features")
  22. chrome_options.add_argument("--disable-blink-features=AutomationControlled")
  23. chrome_options.add_argument('--incognito') # 无痕模式
  24. # -------------------------------------------------------------------- #
  25. driver = webdriver.Chrome(chrome_driver, options=chrome_options)

常用Option

(对于下面配置项,前面加上“--”,再加入ChromeOption中即可,如“--allow-cross-origin-auth-prompt”)

来源:https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_switches.cc​​​​​​

  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "chrome/common/chrome_switches.h"
  5. #include "build/build_config.h"
  6. #include "build/chromeos_buildflags.h"
  7. #include "ppapi/buildflags/buildflags.h"
  8. #include "printing/buildflags/buildflags.h"
  9. namespace switches {
  10. // -----------------------------------------------------------------------------
  11. // Can't find the switch you are looking for? Try looking in:
  12. // ash/constants/ash_switches.cc
  13. // base/base_switches.cc
  14. // etc.
  15. //
  16. // When commenting your switch, please use the same voice as surrounding
  17. // comments. Imagine "This switch..." at the beginning of the phrase, and it'll
  18. // all work out.
  19. // -----------------------------------------------------------------------------
  20. // Specifies Accept-Language to send to servers and expose to JavaScript via the
  21. // navigator.language DOM property. language[-country] where language is the 2
  22. // letter code from ISO-639.
  23. const char kAcceptLang[] = "accept-lang";
  24. // Allows third-party content included on a page to prompt for a HTTP basic
  25. // auth username/password pair.
  26. const char kAllowCrossOriginAuthPrompt[] = "allow-cross-origin-auth-prompt";
  27. // Allow non-secure origins to use the screen capture API and the desktopCapture
  28. // extension API.
  29. const char kAllowHttpScreenCapture[] = "allow-http-screen-capture";
  30. // Allows profiles to be created outside of the user data dir.
  31. // TODO(https://crbug.com/1060366): Various places in Chrome assume that all
  32. // profiles are within the user data dir. Some tests need to violate that
  33. // assumption. The switch should be removed after this workaround is no longer
  34. // needed.
  35. const char kAllowProfilesOutsideUserDir[] = "allow-profiles-outside-user-dir";
  36. // By default, an https page cannot run JavaScript, CSS or plugins from http
  37. // URLs. This provides an override to get the old insecure behavior.
  38. const char kAllowRunningInsecureContent[] = "allow-running-insecure-content";
  39. // Allows Web Push notifications that do not show a notification.
  40. const char kAllowSilentPush[] = "allow-silent-push";
  41. // Specifies that the associated value should be launched in "application"
  42. // mode.
  43. const char kApp[] = "app";
  44. // Specifies that the extension-app with the specified id should be launched
  45. // according to its configuration.
  46. const char kAppId[] = "app-id";
  47. // Overrides the launch url of an app with the specified url. This is used
  48. // along with kAppId to launch a given app with the url corresponding to an item
  49. // in the app's shortcuts menu.
  50. const char kAppLaunchUrlForShortcutsMenuItem[] =
  51. "app-launch-url-for-shortcuts-menu-item";
  52. // Value of GAIA auth code for --force-app-mode.
  53. const char kAppModeAuthCode[] = "app-mode-auth-code";
  54. // Value of OAuth2 refresh token for --force-app-mode.
  55. const char kAppModeOAuth2Token[] = "app-mode-oauth-token";
  56. // This is used along with kAppId to indicate an app was launched during
  57. // OS login, and which mode the app was launched in.
  58. const char kAppRunOnOsLoginMode[] = "app-run-on-os-login-mode";
  59. // The URL that the webstore APIs download extensions from.
  60. // Note: the URL must contain one '%s' for the extension ID.
  61. const char kAppsGalleryDownloadURL[] = "apps-gallery-download-url";
  62. // The update url used by gallery/webstore extensions.
  63. const char kAppsGalleryUpdateURL[] = "apps-gallery-update-url";
  64. // The URL to use for the gallery link in the app launcher.
  65. const char kAppsGalleryURL[] = "apps-gallery-url";
  66. // Allowlist for Negotiate Auth servers
  67. const char kAuthServerAllowlist[] = "auth-server-whitelist";
  68. // This flag makes Chrome auto-open DevTools window for each tab. It is
  69. // intended to be used by developers and automation to not require user
  70. // interaction for opening DevTools.
  71. const char kAutoOpenDevToolsForTabs[] = "auto-open-devtools-for-tabs";
  72. // This flag makes Chrome auto-select the provided choice when an extension asks
  73. // permission to start desktop capture. Should only be used for tests. For
  74. // instance, --auto-select-desktop-capture-source="Entire screen" will
  75. // automatically select sharing the entire screen in English locales. The switch
  76. // value only needs to be substring of the capture source name, i.e. "display"
  77. // would match "Built-in display" and "External display", whichever comes first.
  78. const char kAutoSelectDesktopCaptureSource[] =
  79. "auto-select-desktop-capture-source";
  80. // This flag makes Chrome auto-select a tab with the provided title when
  81. // the media-picker should otherwise be displayed to the user. This switch
  82. // is very similar to kAutoSelectDesktopCaptureSource, but limits selection
  83. // to tabs. This solves the issue of kAutoSelectDesktopCaptureSource being
  84. // liable to accidentally capturing the Chromium window instead of the tab,
  85. // as both have the same title if the tab is focused.
  86. const char kAutoSelectTabCaptureSourceByTitle[] =
  87. "auto-select-tab-capture-source-by-title";
  88. // How often (in seconds) to check for updates. Should only be used for testing
  89. // purposes.
  90. const char kCheckForUpdateIntervalSec[] = "check-for-update-interval";
  91. // Comma-separated list of SSL cipher suites to disable.
  92. const char kCipherSuiteBlacklist[] = "cipher-suite-blacklist";
  93. // Comma-separated list of BrowserThreads that cause browser process to crash if
  94. // the given browser thread is not responsive. UI/IO are the BrowserThreads that
  95. // are supported.
  96. //
  97. // For example:
  98. // --crash-on-hang-threads=UI:18,IO:18 --> Crash the browser if UI or IO is
  99. // not responsive for 18 seconds while the other browser thread is
  100. // responsive.
  101. const char kCrashOnHangThreads[] = "crash-on-hang-threads";
  102. // Some platforms like ChromeOS default to empty desktop.
  103. // Browser tests may need to add this switch so that at least one browser
  104. // instance is created on startup.
  105. // TODO(nkostylev): Investigate if this switch could be removed.
  106. // (http://crbug.com/148675)
  107. const char kCreateBrowserOnStartupForTests[] =
  108. "create-browser-on-startup-for-tests";
  109. // Specifies the http:// endpoint which will be used to serve
  110. // devtools://devtools/custom/<path>
  111. // Or a file:// URL to specify a custom file path to load from for
  112. // devtools://devtools/bundled/<path>
  113. const char kCustomDevtoolsFrontend[] = "custom-devtools-frontend";
  114. // Enables a frame context menu item that toggles the frame in and out of glass
  115. // mode (Windows Vista and up only).
  116. const char kDebugEnableFrameToggle[] = "debug-enable-frame-toggle";
  117. // Adds debugging entries such as Inspect Element to context menus of packed
  118. // apps.
  119. const char kDebugPackedApps[] = "debug-packed-apps";
  120. // Passes command line parameters to the DevTools front-end.
  121. const char kDevToolsFlags[] = "devtools-flags";
  122. // Triggers a plethora of diagnostic modes.
  123. const char kDiagnostics[] = "diagnostics";
  124. // Sets the output format for diagnostic modes enabled by diagnostics flag.
  125. const char kDiagnosticsFormat[] = "diagnostics-format";
  126. // Tells the diagnostics mode to do the requested recovery step(s).
  127. const char kDiagnosticsRecovery[] = "diagnostics-recovery";
  128. // Disable several subsystems which run network requests in the background.
  129. // This is for use when doing network performance testing to avoid noise in the
  130. // measurements.
  131. const char kDisableBackgroundNetworking[] = "disable-background-networking";
  132. // Disables the client-side phishing detection feature. Note that even if
  133. // client-side phishing detection is enabled, it will only be active if the
  134. // user has opted in to UMA stats and SafeBrowsing is enabled in the
  135. // preferences.
  136. const char kDisableClientSidePhishingDetection[] =
  137. "disable-client-side-phishing-detection";
  138. // Disable default component extensions with background pages - useful for
  139. // performance tests where these pages may interfere with perf results.
  140. const char kDisableComponentExtensionsWithBackgroundPages[] =
  141. "disable-component-extensions-with-background-pages";
  142. const char kDisableComponentUpdate[] = "disable-component-update";
  143. // Disables installation of default apps on first run. This is used during
  144. // automated testing.
  145. const char kDisableDefaultApps[] = "disable-default-apps";
  146. // Disables Domain Reliability Monitoring.
  147. const char kDisableDomainReliability[] = "disable-domain-reliability";
  148. // Disable extensions.
  149. const char kDisableExtensions[] = "disable-extensions";
  150. // Disable extensions except those specified in a comma-separated list.
  151. const char kDisableExtensionsExcept[] = "disable-extensions-except";
  152. // Disable checking for user opt-in for extensions that want to inject script
  153. // into file URLs (ie, always allow it). This is used during automated testing.
  154. const char kDisableExtensionsFileAccessCheck[] =
  155. "disable-extensions-file-access-check";
  156. // Disables print preview (For testing, and for users who don't like us. :[ )
  157. const char kDisablePrintPreview[] = "disable-print-preview";
  158. // Normally when the user attempts to navigate to a page that was the result of
  159. // a post we prompt to make sure they want to. This switch may be used to
  160. // disable that check. This switch is used during automated testing.
  161. const char kDisablePromptOnRepost[] = "disable-prompt-on-repost";
  162. // Disable stack profiling. Stack profiling may change performance. Disabling
  163. // stack profiling is beneficial when comparing performance metrics with a
  164. // build that has it disabled by default.
  165. const char kDisableStackProfiler[] = "disable-stack-profiler";
  166. // Some tests seem to require the application to close when the last
  167. // browser window is closed. Thus, we need a switch to force this behavior
  168. // for ChromeOS Aura, disable "zero window mode".
  169. // TODO(pkotwicz): Investigate if this bug can be removed.
  170. // (http://crbug.com/119175)
  171. const char kDisableZeroBrowsersOpenForTests[] =
  172. "disable-zero-browsers-open-for-tests";
  173. // Use a specific disk cache location, rather than one derived from the
  174. // UserDatadir.
  175. const char kDiskCacheDir[] = "disk-cache-dir";
  176. // Forces the maximum disk space to be used by the disk cache, in bytes.
  177. const char kDiskCacheSize[] = "disk-cache-size";
  178. // Requests that a running browser process dump its collected histograms to a
  179. // given file. The file is overwritten if it exists.
  180. const char kDumpBrowserHistograms[] = "dump-browser-histograms";
  181. // If the WebRTC logging private API is active, enables audio debug recordings.
  182. const char kEnableAudioDebugRecordingsFromExtension[] =
  183. "enable-audio-debug-recordings-from-extension";
  184. // Enables the multi-level undo system for bookmarks.
  185. const char kEnableBookmarkUndo[] = "enable-bookmark-undo";
  186. // This applies only when the process type is "service". Enables the Cloud Print
  187. // Proxy component within the service process.
  188. const char kEnableCloudPrintProxy[] = "enable-cloud-print-proxy";
  189. // Enables CriticalPersistedTabData - redesign/replacement for TabState
  190. const char kEnableCriticalPersistedTabData[] =
  191. "enable-critical-persisted-tab-data";
  192. // Enables Domain Reliability Monitoring.
  193. const char kEnableDomainReliability[] = "enable-domain-reliability";
  194. // Enables logging for extension activity.
  195. const char kEnableExtensionActivityLogging[] =
  196. "enable-extension-activity-logging";
  197. const char kEnableExtensionActivityLogTesting[] =
  198. "enable-extension-activity-log-testing";
  199. // Runs the Native Client inside the renderer process and enables GPU plugin
  200. // (internally adds lEnableGpuPlugin to the command line).
  201. const char kEnableNaCl[] = "enable-nacl";
  202. // Enables the network-related benchmarking extensions.
  203. const char kEnableNetBenchmarking[] = "enable-net-benchmarking";
  204. // Enables a number of potentially annoying security features (strict mixed
  205. // content mode, powerful feature restrictions, etc.)
  206. const char kEnablePotentiallyAnnoyingSecurityFeatures[] =
  207. "enable-potentially-annoying-security-features";
  208. // Allows overriding the list of restricted ports by passing a comma-separated
  209. // list of port numbers.
  210. const char kExplicitlyAllowedPorts[] = "explicitly-allowed-ports";
  211. // Name of the command line flag to force content verification to be on in one
  212. // of various modes.
  213. const char kExtensionContentVerification[] = "extension-content-verification";
  214. // Values for the kExtensionContentVerification flag.
  215. // See ContentVerifierDelegate::Mode for more explanation.
  216. const char kExtensionContentVerificationBootstrap[] = "bootstrap";
  217. const char kExtensionContentVerificationEnforce[] = "enforce";
  218. const char kExtensionContentVerificationEnforceStrict[] = "enforce_strict";
  219. // Turns on extension install verification if it would not otherwise have been
  220. // turned on.
  221. const char kExtensionsInstallVerification[] = "extensions-install-verification";
  222. // Specifies a comma-separated list of extension ids that should be forced to
  223. // be treated as not from the webstore when doing install verification.
  224. const char kExtensionsNotWebstore[] = "extensions-not-webstore";
  225. // Forces application mode. This hides certain system UI elements and forces
  226. // the app to be installed if it hasn't been already.
  227. const char kForceAppMode[] = "force-app-mode";
  228. // Displays the First Run experience when the browser is started, regardless of
  229. // whether or not it's actually the First Run (this overrides kNoFirstRun).
  230. const char kForceFirstRun[] = "force-first-run";
  231. // Displays the What's New experience when the browser is started if it has not
  232. // yet been shown for the current milestone (this overrides kNoFirstRun, without
  233. // showing the First Run experience).
  234. const char kForceWhatsNew[] = "force-whats-new";
  235. // Does not show the crash restore bubble when the browser is started during the
  236. // system startup phase in ChromeOS, if the ChromeOS full restore feature is
  237. // enabled, because the ChromeOS full restore notification is shown for the user
  238. // to select restore or not.
  239. const char kHideCrashRestoreBubble[] = "hide-crash-restore-bubble";
  240. // Specifies which page will be displayed in newly-opened tabs. We need this
  241. // for testing purposes so that the UI tests don't depend on what comes up for
  242. // http://google.com.
  243. const char kHomePage[] = "homepage";
  244. // Causes the browser to launch directly in incognito mode.
  245. const char kIncognito[] = "incognito";
  246. // Installs an autogenerated theme based on the given RGB value.
  247. // The format is "r,g,b", where r, g, b are a numeric values from 0 to 255.
  248. const char kInstallAutogeneratedTheme[] = "install-autogenerated-theme";
  249. // Causes Chrome to initiate an installation flow for the given app.
  250. const char kInstallChromeApp[] = "install-chrome-app";
  251. // Marks a renderer as an Instant process.
  252. const char kInstantProcess[] = "instant-process";
  253. // Used for testing - keeps browser alive after last browser window closes.
  254. const char kKeepAliveForTest[] = "keep-alive-for-test";
  255. // Enable kiosk mode. Please note this is not Chrome OS kiosk mode.
  256. const char kKioskMode[] = "kiosk";
  257. // Enable automatically pressing the print button in print preview.
  258. const char kKioskModePrinting[] = "kiosk-printing";
  259. // Makes Chrome default browser
  260. const char kMakeDefaultBrowser[] = "make-default-browser";
  261. // Allows setting a different destination ID for connection-monitoring GCM
  262. // messages. Useful when running against a non-prod management server.
  263. const char kMonitoringDestinationID[] = "monitoring-destination-id";
  264. // Requests a native messaging connection be established between the native
  265. // messaging host named by this switch and the extension with ID specified by
  266. // kNativeMessagingConnectExtension.
  267. const char kNativeMessagingConnectHost[] = "native-messaging-connect-host";
  268. // Requests a native messaging connection be established between the extension
  269. // with ID specified by this switch and the native messaging host named by the
  270. // kNativeMessagingConnectHost switch.
  271. const char kNativeMessagingConnectExtension[] =
  272. "native-messaging-connect-extension";
  273. // If set when kNativeMessagingConnectHost and kNativeMessagingConnectExtension
  274. // are specified, is reflected to the native messaging host as a command line
  275. // parameter.
  276. const char kNativeMessagingConnectId[] = "native-messaging-connect-id";
  277. // Disables the default browser check. Useful for UI/browser tests where we
  278. // want to avoid having the default browser info-bar displayed.
  279. const char kNoDefaultBrowserCheck[] = "no-default-browser-check";
  280. // Disables all experiments set on about:flags. Does not disable about:flags
  281. // itself. Useful if an experiment makes chrome crash at startup: One can start
  282. // chrome with --no-experiments, disable the problematic lab at about:flags and
  283. // then restart chrome without this switch again.
  284. const char kNoExperiments[] = "no-experiments";
  285. // Skip First Run tasks, whether or not it's actually the First Run, and the
  286. // What's New page. Overridden by kForceFirstRun (for FRE) and kForceWhatsNew
  287. // (for What's New). This does not drop the First Run sentinel and thus doesn't
  288. // prevent first run from occurring the next time chrome is launched without
  289. // this flag. It also does not update the last What's New milestone, so does not
  290. // prevent What's New from occurring the next time chrome is launched without
  291. // this flag.
  292. const char kNoFirstRun[] = "no-first-run";
  293. // Don't send hyperlink auditing pings
  294. const char kNoPings[] = "no-pings";
  295. // Don't use a proxy server, always make direct connections. Overrides any
  296. // other proxy server flags that are passed.
  297. const char kNoProxyServer[] = "no-proxy-server";
  298. // Disables the service process from adding itself as an autorun process. This
  299. // does not delete existing autorun registrations, it just prevents the service
  300. // from registering a new one.
  301. const char kNoServiceAutorun[] = "no-service-autorun";
  302. // Does not automatically open a browser window on startup (used when
  303. // launching Chrome for the purpose of hosting background apps).
  304. const char kNoStartupWindow[] = "no-startup-window";
  305. // Calculate the hash of an MHTML file as it is being saved.
  306. // The browser process will write the serialized MHTML contents to a file and
  307. // calculate its hash as it is streamed back from the renderer via a Mojo data
  308. // pipe.
  309. const char kOnTheFlyMhtmlHashComputation[] =
  310. "on-the-fly-mhtml-hash-computation";
  311. // Launches URL in new browser window.
  312. const char kOpenInNewWindow[] = "new-window";
  313. // Packages an extension to a .crx installable file from a given directory.
  314. const char kPackExtension[] = "pack-extension";
  315. // Optional PEM private key to use in signing packaged .crx.
  316. const char kPackExtensionKey[] = "pack-extension-key";
  317. // Used to mock the response received from the Web Permission Prediction
  318. // Service. Used for testing.
  319. const char kPredictionServiceMockLikelihood[] =
  320. "prediction-service-mock-likelihood";
  321. // A directory where Chrome looks for json files describing default/preinstalled
  322. // web apps. This overrides any default directory to load preinstalled web apps
  323. // from.
  324. const char kPreinstalledWebAppsDir[] = "preinstalled-web-apps-dir";
  325. // Use IPv6 only for privet HTTP.
  326. const char kPrivetIPv6Only[] = "privet-ipv6-only";
  327. // Outputs the product version information and quit. Used as an internal api to
  328. // detect the installed version of Chrome on Linux.
  329. const char kProductVersion[] = "product-version";
  330. // Selects directory of profile to associate with the first browser launched.
  331. const char kProfileDirectory[] = "profile-directory";
  332. // Like kProfileDirectory, but selects the profile by email address. If the
  333. // email is not found in any existing profile, this switch has no effect. If
  334. // both kProfileDirectory and kProfileUserName are specified, kProfileDirectory
  335. // takes priority.
  336. const char kProfileEmail[] = "profile-email";
  337. // Forces proxy auto-detection.
  338. const char kProxyAutoDetect[] = "proxy-auto-detect";
  339. // Specifies a list of hosts for whom we bypass proxy settings and use direct
  340. // connections. Ignored if --proxy-auto-detect or --no-proxy-server are also
  341. // specified. This is a comma-separated list of bypass rules. See:
  342. // "net/proxy_resolution/proxy_bypass_rules.h" for the format of these rules.
  343. const char kProxyBypassList[] = "proxy-bypass-list";
  344. // Uses the pac script at the given URL
  345. const char kProxyPacUrl[] = "proxy-pac-url";
  346. // Porvides a list of addresses to discover DevTools remote debugging targets.
  347. // The format is <host>:<port>,...,<host>:port.
  348. const char kRemoteDebuggingTargets[] = "remote-debugging-targets";
  349. // Indicates the last session should be restored on startup. This overrides the
  350. // preferences value. Note that this does not force automatic session restore
  351. // following a crash, so as to prevent a crash loop. This switch is used to
  352. // implement support for OS-specific "continue where you left off" functionality
  353. // on OS X and Windows.
  354. const char kRestoreLastSession[] = "restore-last-session";
  355. // Disable saving pages as HTML-only, disable saving pages as HTML Complete
  356. // (with a directory of sub-resources). Enable only saving pages as MHTML.
  357. // See http://crbug.com/120416 for how to remove this switch.
  358. const char kSavePageAsMHTML[] = "save-page-as-mhtml";
  359. // Does not show an infobar when an extension attaches to a page using
  360. // chrome.debugger page. Required to attach to extension background pages.
  361. const char kSilentDebuggerExtensionAPI[] = "silent-debugger-extension-api";
  362. // Causes Chrome to launch without opening any windows by default. Useful if
  363. // one wishes to use Chrome as an ash server.
  364. const char kSilentLaunch[] = "silent-launch";
  365. // Simulates a critical update being available.
  366. const char kSimulateCriticalUpdate[] = "simulate-critical-update";
  367. // Simulates that elevation is needed to recover upgrade channel.
  368. const char kSimulateElevatedRecovery[] = "simulate-elevated-recovery";
  369. // Simulates that current version is outdated.
  370. const char kSimulateOutdated[] = "simulate-outdated";
  371. // Simulates that current version is outdated and auto-update is off.
  372. const char kSimulateOutdatedNoAU[] = "simulate-outdated-no-au";
  373. // Simulates an update being available.
  374. const char kSimulateUpgrade[] = "simulate-upgrade";
  375. // Specifies the maximum SSL/TLS version ("tls1.2" or "tls1.3").
  376. const char kSSLVersionMax[] = "ssl-version-max";
  377. // Specifies the minimum SSL/TLS version ("tls1.2" or "tls1.3").
  378. const char kSSLVersionMin[] = "ssl-version-min";
  379. // TLS 1.2 mode for |kSSLVersionMax| and |kSSLVersionMin| switches.
  380. const char kSSLVersionTLSv12[] = "tls1.2";
  381. // TLS 1.3 mode for |kSSLVersionMax| and |kSSLVersionMin| switches.
  382. const char kSSLVersionTLSv13[] = "tls1.3";
  383. // Starts the browser maximized, regardless of any previous settings.
  384. const char kStartMaximized[] = "start-maximized";
  385. // Starts the stack sampling profiler in the child process.
  386. const char kStartStackProfiler[] = "start-stack-profiler";
  387. // Browser test mode for the |kStartStackProfiler| switch. Limits the profile
  388. // durations to be significantly less than the test timeout.
  389. const char kStartStackProfilerBrowserTest[] = "browser-test";
  390. // Interval, in minutes, used for storage pressure notification throttling.
  391. // Useful for developers testing applications that might use non-trivial
  392. // amounts of disk space.
  393. const char kStoragePressureNotificationInterval[] =
  394. "storage-pressure-notification-interval";
  395. // Sets the supervised user ID for any loaded or newly created profile to the
  396. // given value. Pass an empty string to mark the profile as non-supervised.
  397. // Used for testing.
  398. const char kSupervisedUserId[] = "managed-user-id";
  399. // Frequency in Milliseconds for system log uploads. Should only be used for
  400. // testing purposes.
  401. const char kSystemLogUploadFrequency[] = "system-log-upload-frequency";
  402. // This flag makes Chrome auto-accept/reject requests to capture the current
  403. // tab. It should only be used for tests.
  404. const char kThisTabCaptureAutoAccept[] = "auto-accept-this-tab-capture";
  405. const char kThisTabCaptureAutoReject[] = "auto-reject-this-tab-capture";
  406. // Passes the name of the current running automated test to Chrome.
  407. const char kTestName[] = "test-name";
  408. // Identifies a list of download sources as trusted, but only if proper group
  409. // policy is set.
  410. const char kTrustedDownloadSources[] = "trusted-download-sources";
  411. // Experimental. Shows a dialog asking the user to try chrome. This flag is to
  412. // be used only by the upgrade process.
  413. const char kTryChromeAgain[] = "try-chrome-again";
  414. // Overrides per-origin quota settings to unlimited storage for any
  415. // apps/origins. This should be used only for testing purpose.
  416. const char kUnlimitedStorage[] = "unlimited-storage";
  417. // Specifies the user data directory, which is where the browser will look for
  418. // all of its state.
  419. const char kUserDataDir[] = "user-data-dir";
  420. // Uses WinHttp to resolve proxies instead of using Chromium's normal proxy
  421. // resolution logic. This is only supported in Windows.
  422. //
  423. // TODO(https://crbug.com/1032820): Only use WinHttp whenever Chrome is
  424. // exclusively using system proxy configs.
  425. const char kUseSystemProxyResolver[] = "use-system-proxy-resolver";
  426. // Examines a .crx for validity and prints the result.
  427. const char kValidateCrx[] = "validate-crx";
  428. // Prints version information and quits.
  429. const char kVersion[] = "version";
  430. // Sets the delay (in seconds) between proactive prunings of remote-bound
  431. // WebRTC event logs which are pending upload.
  432. // All positive values are legal.
  433. // All negative values are illegal, and ignored.
  434. // If set to 0, the meaning is "no proactive pruning".
  435. const char kWebRtcRemoteEventLogProactivePruningDelta[] =
  436. "webrtc-event-log-proactive-pruning-delta";
  437. // WebRTC event logs will only be uploaded if the conditions hold for this
  438. // many milliseconds.
  439. const char kWebRtcRemoteEventLogUploadDelayMs[] =
  440. "webrtc-event-log-upload-delay-ms";
  441. // Normally, remote-bound WebRTC event logs are uploaded only when no
  442. // peer connections are active. With this flag, the upload is never suppressed.
  443. const char kWebRtcRemoteEventLogUploadNoSuppression[] =
  444. "webrtc-event-log-upload-no-suppression";
  445. // Specify the initial window position: --window-position=x,y
  446. const char kWindowPosition[] = "window-position";
  447. // Specify the initial window size: --window-size=w,h
  448. const char kWindowSize[] = "window-size";
  449. // Specify the initial window workspace: --window-workspace=id
  450. const char kWindowWorkspace[] = "window-workspace";
  451. // Uses WinHTTP to fetch and evaluate PAC scripts. Otherwise the default is to
  452. // use Chromium's network stack to fetch, and V8 to evaluate.
  453. const char kWinHttpProxyResolver[] = "winhttp-proxy-resolver";
  454. // Specifies which category option was clicked in the Windows Jumplist that
  455. // resulted in a browser startup.
  456. const char kWinJumplistAction[] = "win-jumplist-action";
  457. #if BUILDFLAG(IS_ANDROID)
  458. // Android authentication account type for SPNEGO authentication
  459. const char kAuthAndroidNegotiateAccountType[] = "auth-spnego-account-type";
  460. // Enable the accessibility tab switcher.
  461. const char kEnableAccessibilityTabSwitcher[] =
  462. "enable-accessibility-tab-switcher";
  463. // Enables a hung renderer InfoBar allowing the user to close or wait on
  464. // unresponsive web content.
  465. const char kEnableHungRendererInfoBar[] = "enable-hung-renderer-infobar";
  466. // Forces the device to report being owned by an enterprise. This mimics the
  467. // presence of an app signaling device ownerhsip.
  468. const char kForceDeviceOwnership[] = "force-device-ownership";
  469. // Forces the night mode to be enabled.
  470. const char kForceEnableNightMode[] = "force-enable-night-mode";
  471. // Forces the update menu badge to show.
  472. const char kForceShowUpdateMenuBadge[] = "force-show-update-menu-badge";
  473. // Forces signin FRE flow.
  474. const char kForceEnableSigninFRE[] = "force-enable-signin-fre";
  475. // Forces the FRE to go through the legacy sync consent flow for testing.
  476. const char kForceDisableSigninFRE[] = "force-disable-signin-fre";
  477. // Forces the update menu type to a specific type.
  478. const char kForceUpdateMenuType[] = "force-update-menu-type";
  479. // Forces a custom summary to be displayed below the update menu item.
  480. const char kForceShowUpdateMenuItemCustomSummary[] = "custom_summary";
  481. // Sets the market URL for Chrome for use in testing.
  482. const char kMarketUrlForTesting[] = "market-url-for-testing";
  483. #endif // BUILDFLAG(IS_ANDROID)
  484. #if BUILDFLAG(IS_CHROMEOS_ASH)
  485. // Custom crosh command.
  486. const char kCroshCommand[] = "crosh-command";
  487. // Disables logging redirect for testing.
  488. const char kDisableLoggingRedirect[] = "disable-logging-redirect";
  489. // Disables apps on the login screen. By default, they are allowed and can be
  490. // installed through policy.
  491. const char kDisableLoginScreenApps[] = "disable-login-screen-apps";
  492. // Use a short (1 second) timeout for merge session loader throttle testing.
  493. const char kShortMergeSessionTimeoutForTest[] =
  494. "short-merge-session-timeout-for-test";
  495. // Selects the scheduler configuration specified in the parameter.
  496. const char kSchedulerConfiguration[] = "scheduler-configuration";
  497. const char kSchedulerConfigurationConservative[] = "conservative";
  498. const char kSchedulerConfigurationPerformance[] = "performance";
  499. // Specifies what the default scheduler configuration value is if the user does
  500. // not set one.
  501. const char kSchedulerConfigurationDefault[] = "scheduler-configuration-default";
  502. #endif // BUILDFLAG(IS_CHROMEOS_ASH)
  503. #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_CHROMEOS_ASH)
  504. // These flags show the man page on Linux. They are equivalent to each
  505. // other.
  506. const char kHelp[] = "help";
  507. const char kHelpShort[] = "h";
  508. // Specifies which encryption storage backend to use. Possible values are
  509. // kwallet, kwallet5, gnome, gnome-keyring, gnome-libsecret, basic. Any other
  510. // value will lead to Chrome detecting the best backend automatically.
  511. // TODO(crbug.com/571003): Once PasswordStore no longer uses the Keyring or
  512. // KWallet for storing passwords, rename this flag to stop referencing
  513. // passwords. Do not rename it sooner, though; developers and testers might
  514. // rely on it keeping large amounts of testing passwords out of their Keyrings
  515. // or KWallets.
  516. const char kPasswordStore[] = "password-store";
  517. // Enables the feature of allowing the user to disable the backend via a
  518. // setting.
  519. const char kEnableEncryptionSelection[] = "enable-encryption-selection";
  520. // The same as the --class argument in X applications. Overrides the WM_CLASS
  521. // window property with the given value.
  522. const char kWmClass[] = "class";
  523. #endif
  524. #if BUILDFLAG(IS_MAC)
  525. // Prevents Chrome from quitting when Chrome Apps are open.
  526. const char kAppsKeepChromeAliveInTests[] = "apps-keep-chrome-alive-in-tests";
  527. // Enable user metrics from within the installer.
  528. const char kEnableUserMetrics[] = "enable-user-metrics";
  529. // This is how the metrics client ID is passed from the browser process to its
  530. // children. With Crashpad, the metrics client ID is distinct from the crash
  531. // client ID.
  532. const char kMetricsClientID[] = "metrics-client-id";
  533. // A process type (switches::kProcessType) that relaunches the browser. See
  534. // chrome/browser/mac/relauncher.h.
  535. const char kRelauncherProcess[] = "relauncher";
  536. // When switches::kProcessType is switches::kRelauncherProcess, if this switch
  537. // is also present, the relauncher process will unmount and eject a mounted disk
  538. // image and move its disk image file to the trash. The argument's value must
  539. // be a BSD device name of the form "diskN" or "diskNsM".
  540. const char kRelauncherProcessDMGDevice[] = "dmg-device";
  541. // Indicates whether Chrome should be set as the default browser during
  542. // installation.
  543. const char kMakeChromeDefault[] = "make-chrome-default";
  544. #endif // BUILDFLAG(IS_MAC)
  545. #if BUILDFLAG(IS_WIN)
  546. // Disables custom-drawing the window titlebar on Windows 10.
  547. const char kDisableWindows10CustomTitlebar[] =
  548. "disable-windows10-custom-titlebar";
  549. // Force-enables the profile shortcut manager. This is needed for tests since
  550. // they use a custom-user-data-dir which disables this.
  551. const char kEnableProfileShortcutManager[] = "enable-profile-shortcut-manager";
  552. // Indicates that this launch of the browser originated from the installer
  553. // (i.e., following a successful new install or over-install). This triggers
  554. // browser behaviors for this specific launch, such as a welcome announcement
  555. // for accessibility software (see https://crbug.com/1072735).
  556. extern const char kFromInstaller[] = "from-installer";
  557. // Makes Windows happy by allowing it to show "Enable access to this program"
  558. // checkbox in Add/Remove Programs->Set Program Access and Defaults. This only
  559. // shows an error box because the only way to hide Chrome is by uninstalling
  560. // it.
  561. const char kHideIcons[] = "hide-icons";
  562. // Whether or not the browser should warn if the profile is on a network share.
  563. // This flag is only relevant for Windows currently.
  564. const char kNoNetworkProfileWarning[] = "no-network-profile-warning";
  565. // Used in combination with kNotificationLaunchId to specify the inline reply
  566. // entered in the toast in the Windows Action Center.
  567. const char kNotificationInlineReply[] = "notification-inline-reply";
  568. // Used for launching Chrome when a toast displayed in the Windows Action Center
  569. // has been activated. Should contain the launch ID encoded by Chrome.
  570. const char kNotificationLaunchId[] = "notification-launch-id";
  571. // /prefetch:# arguments for the browser process launched in background mode and
  572. // for the watcher process. Use profiles 5, 6 and 7 as documented on
  573. // kPrefetchArgument* in content_switches.cc.
  574. const char kPrefetchArgumentBrowserBackground[] = "/prefetch:5";
  575. // /prefetch:6 was formerly used by the watcher but is no longer used.
  576. // /prefetch:7 is used by crashpad, which can't depend on constants defined
  577. // here. See crashpad_win.cc for more details.
  578. // See kHideIcons.
  579. const char kShowIcons[] = "show-icons";
  580. // Runs un-installation steps that were done by chrome first-run.
  581. const char kUninstall[] = "uninstall";
  582. // Specifies that the WebApp with the specified id should be uninstalled.
  583. const char kUninstallAppId[] = "uninstall-app-id";
  584. // Specifies the version of the Progressive-Web-App launcher that launched
  585. // Chrome, used to determine whether to update all launchers.
  586. // NOTE: changing this switch requires adding legacy handling for the previous
  587. // method, as older PWA launchers still using this switch will rely on Chrome to
  588. // update them to use the new method.
  589. const char kPwaLauncherVersion[] = "pwa-launcher-version";
  590. #endif // BUILDFLAG(IS_WIN)
  591. #if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD)
  592. // Enables support to debug printing subsystem.
  593. const char kDebugPrint[] = "debug-print";
  594. #endif
  595. #if BUILDFLAG(ENABLE_PLUGINS)
  596. // Specifies comma-separated list of extension ids or hosts to grant
  597. // access to CRX file system APIs.
  598. const char kAllowNaClCrxFsAPI[] = "allow-nacl-crxfs-api";
  599. // Specifies comma-separated list of extension ids or hosts to grant
  600. // access to file handle APIs.
  601. const char kAllowNaClFileHandleAPI[] = "allow-nacl-file-handle-api";
  602. // Specifies comma-separated list of extension ids or hosts to grant
  603. // access to TCP/UDP socket APIs.
  604. const char kAllowNaClSocketAPI[] = "allow-nacl-socket-api";
  605. #endif
  606. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
  607. BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA)
  608. const char kEnableNewAppMenuIcon[] = "enable-new-app-menu-icon";
  609. // Causes the browser to launch directly in guest mode.
  610. const char kGuest[] = "guest";
  611. #endif
  612. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
  613. // Writes open and installed web apps for each profile to the specified file
  614. // without launching a new browser window or tab. Pass a absolute file path to
  615. // specify where to output the information. Can be used together with optional
  616. // --profile-base-name switch to only write information for a given profile.
  617. const char kListApps[] = "list-apps";
  618. // Pass the basename of the profile directory to specify which profile to get
  619. // information. Only relevant when used with --list-apps switch.
  620. const char kProfileBaseName[] = "profile-base-name";
  621. #endif
  622. #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID)
  623. // Custom WebAPK server URL for the sake of testing.
  624. const char kWebApkServerUrl[] = "webapk-server-url";
  625. #endif
  626. #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
  627. // Uses the system default printer as the initially selected destination in
  628. // print preview, instead of the most recently used destination.
  629. const char kUseSystemDefaultPrinter[] = "use-system-default-printer";
  630. #endif
  631. #if BUILDFLAG(ENABLE_DOWNGRADE_PROCESSING)
  632. // Indicates that this process is the product of a relaunch following migration
  633. // of User Data.
  634. const char kUserDataMigrated[] = "user-data-migrated";
  635. #endif
  636. // -----------------------------------------------------------------------------
  637. // DO NOT ADD YOUR VERY NICE FLAGS TO THE BOTTOM OF THIS FILE.
  638. //
  639. // You were going to just dump your switches here, weren't you? Instead, please
  640. // put them in alphabetical order above, or in order inside the appropriate
  641. // ifdef at the bottom. The order should match the header.
  642. // -----------------------------------------------------------------------------
  643. } // namespace switches

还可以参考:

Chrome flags - Alan's Blog

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/219481?site
推荐阅读
相关标签
  

闽ICP备14008679号