Where can I find a list of all available ChromeOption arguments?
Asked Answered
O

5

102

I am a big advocate for reading the manual. But in this case, despite searching online for some time I cannot find a manual explaining all of the available ChromeOptions arguments. Somewhere there must be a listing of all of the string arguments and what they mean.

For example, here are some that I found by stumbling through examples:

var options = new ChromeOptions();
options.AddArgument("incognito");
options.AddArguments("test-type");

Can someone please direct me to a listing? I am using C# 4.6, Selenium 2.45.

Orchard answered 12/7, 2016 at 17:41 Comment(0)
C
114

List of common switches :
/master/chrome/common/chrome_switches.cc

List of headless switches :
/master/headless/app/headless_shell_switches.cc

To search other switches :
https://source.chromium.org/search?q=file:switches.cc&ss=chromium%2Fchromium%2Fsrc

List of preferences:
/master/chrome/common/pref_names.h

Claytonclaytonia answered 12/7, 2016 at 18:23 Comment(0)
E
109

This is the one I use: http://peter.sh/experiments/chromium-command-line-switches/

var options = new ChromeOptions();
options.AddArgument("--start-maximized");
options.AddArgument("--ignore-certificate-errors");
options.AddArgument("--disable-popup-blocking");
options.AddArgument("--incognito");

and so forth :)

Endomorphism answered 12/7, 2016 at 18:11 Comment(6)
This is a great resource, but Florent's answer is from the official source. Thank youOrchard
Actually not all switches that appear in this non-official resource are listed in the official website. For example there is no mentioning of --headless switch in the official list.Iceberg
+1 This list has significantly more options, more details, and is much easier to read. Even the chrome man page says not all options are listed/official so a resource like this is much more useful. The list also auto updates.Approximation
Is there a similar list for the Firefox and Internet Explorer drivers? I'm having no luck digging those up.Virgilio
This should've been included in official docs. ThanksCrean
Thank you, this led me to try --start-minimized using Edge Chromium 105 which works, finally I can launch a window that is at least somewhat hidden. Now how to close it automatically.Unthread
N
4

Here is an answer about how to use the ChromeOptions used:

ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("--window-size=1920,1080");
options.addArguments("--enable-precise-memory-info");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-default-apps");
options.addArguments("test-type=browser");
Nubianubian answered 25/12, 2018 at 13:10 Comment(1)
why some arguments are with -- (2 dashes) at the beginning but some without?Conative
S
0

I believe this should be like this:

  1. Try to eliminate the "--"
  2. options > option
  3. Capitalize "A" in "Add"
  4. Arguments > Argument
    ChromeOptions option = new ChromeOptions();
    option.AddArgument("test-type");
    option.AddArgument("start-maximized");
    option.AddArgument("window-size=1920,1080");
    option.AddArgument("enable-precise-memory-info");
    option.AddArgument("disable-popup-blocking");
    option.AddArgument("disable-default-apps");
    option.AddArgument("test-type=browser");
Swinton answered 9/3, 2021 at 3:14 Comment(0)
W
0

Latest documentation for Selenium 4 mention ChromOptions arguments in 'Arguments' section -

https://www.selenium.dev/documentation/webdriver/browsers/chrome/#arguments

Wiggler answered 7/3 at 4:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.