Skip to content

Latest commit

 

History

History
89 lines (59 loc) · 5.82 KB

CommandLineSwitches.md

File metadata and controls

89 lines (59 loc) · 5.82 KB

API categories | API index

Command line switches

Table of contents:

Preface

There are many settings that can be customized through Chromium command line switches. These switches can only be set programmatically by passing a dictionary of switches as a second argument to cefpython.Initialize(applicationSettings, commandLineSwitches). The commandLineSwitches param is a dictionary with switch name as a key. The switch name should not contain the "-" or "--" prefix, otherwise it will be ignored. Switch value may be an empty string, if the switch doesn't require a value. These switches are set for the main process and all subprocesses. See the description of the cefpython.Initialize() function to see how to preview the final command line strings formed by CEF.

There are two types of switches, Chromium switches and CEF switches:

Some of the switches in Chromium are experimental, and may crash application if used inappropriately.

When debbugging is On, the whole command line string will be displayed in console, with both CEF switches set internally, and the ones appended by cefpython. On Linux you will also see in console the command line string for subprocesses. On Windows, command line strings for subprocesses won't be seen in console, you can view them by opening the debug.log file. Example command line strings from debug logs, for the main process and the renderer process:

# Main process
python --browser-subprocess-path="C:\cefpython\cefpython\cef3\windows\binaries
/subprocess" --lang=en-US --log-file="C:\cefpython\cefpython\cef3\windows
\binaries\debug.log" --log-severity=info --enable-release-dcheck
--no-sandbox wxpython.py

# Renderer process
"C:\cefpython\cefpython\cef3\windows\binaries/subprocess" --type=renderer
--no-sandbox --lang=en-US --lang=en-US --log-file="C:\cefpython\cefpython\
cef3\windows\binaries\debug.log" --log-severity=info --enable-release-dcheck
--channel="4152.0.209609692\1183564454" /prefetch:673131151

Example switches

enable-media-stream

To enable media (WebRTC audio/video) streaming set the "enable-media-stream" CEF switch. This will enable the getUserMedia function in javascript.

proxy-server

To set custom proxy set the "proxy-server" Chromium switch to "socks5:https://127.0.0.1:8888" for example. See also Proxy Resolution page.

no-proxy-server

By default Chromium uses the IE proxy settings (set in Internet Explorer options), to disable that set the "no-proxy-server" Chromium switch. See also Proxy Resolution page.

disable-gpu

Disable GPU rendering and switch to CPU software rendering. This flag can fix the black/white browser screen issue.

Chromium switches by category

The peter.sh website should list all Chromium switches that are assembled from many Chromium files. Though, some switches may be missing there. Here is a list (in some way categorized) of all Chromium source files that define switches (list assembled on January 16, 2014):