How to execute Selenium Chrome WebDriver in silent mode?
Good question, however, I don't know where you got that .AddArgument("--silent");
thing, as that's Chrome's command line switch, not for ChromeDriver. Also, there isn't a Chrome switch called --silent
anyway.
Under OpenQA.Selenium.Chrome
namespace, there is class called ChromeDriverService
which has a property SuppressInitialDiagnosticInformation
defaults to false. Basically what you might want to do is to create
ChromeDriverService
and pass it into ChromeDriver's constructor. Please refer to the documentation here.
Here is the C# code that suppresses ChromeDriver's diagnostics outputs.
ChromeOptions options = new ChromeOptions();
ChromeDriverService service = ChromeDriverService.CreateDefaultService();
service.SuppressInitialDiagnosticInformation = true;
IWebDriver driver = new ChromeDriver(service, options);
EDIT:
ChromeDriver (not Chrome) has a command line argument --silent
, which is supposed to work. SuppressInitialDiagnosticInformation
in .NET binding does exactly that. However, it seems only suppress some of the messages.
Here is a closed chromedriver ticket: Issue 116: How to disable the diagnostic messages and log file from Chrome Driver?
I simply do this
ChromeOptions options = new ChromeOptions();
options.AddArgument("--log-level=3");
IWebDriver driver = new ChromeDriver(options);