python startup parameters of Chrome

The original manuscript: https://www.cnblogs.com/xiaoxiao-niao/p/7765627.html

The list is updated daily English version https://peter.sh/experiments/chromium-command-line-switches/

1 --allow-outdated-plugins stop using outdated plug-ins.
Under 2 --allow-running-insecure-content by default, https page does not allow references javascript / css / plug-ins from http link. Adding this parameter will release the contents.
3 --allow-scripting-gallery allows scripts to expand into effect in the official application center. By default, for security reasons these scripts are blocked.
4 --disable-accelerated-video disable GPU-accelerated video.
5 --disable-dart disabled Dart.
6 --disable-desktop-notifications to disable desktop notifications in Windows desktop notification is enabled by default.
7 --disable-extensions disabled expansion.
8 --disable-file-system deactivated FileSystem API.
9 --disable-preconnect disabling TCP / IP pre-connected.
10 --disable-remote-fonts off the remote font support. SVG fonts affected by this parameter.
11 --disable-speech-input disable voice input.
12 --disable-web-security non-compliance with the same origin policy.
13 --disk-cache-dir cache provided in a given path.
14 --disk-cache-size limit set the cache size, in bytes.
15 --dns-prefetch-disable disable DNS pre-reading.
16 --enable-print-preview Enable Print Preview.
17 --extensions-update-frequency is set to expand the auto-update frequency, in seconds.
18 --incognito allow the browser to directly start in stealth mode.
19 --keep-alive-for-test after the last label remains closed browser process. (In a sense you can improve the speed of a hot start, but you'd have to have enough memory)
20 --kiosk enable kiosk mode. (Similar to a full-screen browsing mode)
21 --lang using the specified language.
Under 22 --no-displaying-insecure-content by default, https page allows you to refer Pictures / font / framework from http link. Adding this parameter will prevent the content.
23 --no-first-run Chromium skip the first run checks.
24 --no-referrers Http-Referer header is not transmitted.
25 --no-sandbox completely disable the sandbox.
Does not create window 26 --no-startup-window starts.
27 --proxy-pac-url to use proxy pac script given URL. (You can also use a local file, such as PAC-url =---proxy "File: \\\ c: \ proxy.pac")
28 --proxy-Server using the given proxy server, this parameter is only http and https effective. (E.g. --proxy-server = 127.0.0.1: 8087)
29 --single-process Chromium run in single-process mode. (When you start the browser will give a warning of unsafe)
31 --user-Agent using the given User-Agent string

The most commonly used parameters:

When you start to maximize the 30 --start-maximized.

32.download.default_directory ": download_dir set the download path

33.directory_upgrade": True, 

34.safebrowsing.enabled ": True whether to prompt a security warning


Parameters: - user-data-dir = UserDataDir
purposes: to customize the user account folders (eg: -user-data-dir = " D: \ temp \ Chrome User Data")
Parameters: - process-per-tab
uses: use a separate page for each process
parameters: - process-per-site
use: each site uses a separate process
parameters: - in-process-plugins
use: plug-in does not enable the individual process

parameters: - disable-popup-blocking
uses: disable popup interception
parameters: - disable-javascript
purpose: to disable JavaScript
parameters: - disable-java
uses: disable Java
parameters: - disable-plugins
use: disable plug-ins
parameters: -disable-images
uses: disable image
parameters: --omnibox-popup-count = "num "
purpose: the number of pop-up prompts the address bar menu instead of num
parameters: - enable-vertical-tabs
purposes: to adjust chrome tour tags stored on the left, non-top

example:

  Start your browser maximized

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("start-maximized")
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.implicitly_wait(30)
base_url = "http://www.baidu.com"

chrome下载文件去掉安全提示框
from selenium import webdriver

download_dir = "/pathToDownloadDir"
chrome_options = webdriver.ChromeOptions()
preferences = {"download.default_directory": download_dir ,
               "directory_upgrade": True,
               "safebrowsing.enabled": True }
chrome_options.add_experimental_option("prefs", preferences)

Guess you like

Origin www.cnblogs.com/yimai-series/p/12095043.html