Reputation: 13
I am using ChromeDriver in C# code console app, everything works well as I expect. But I need to hide the messages/logs from the chrome driver. Used below code. Still seeing the messages like:
Starting ChromeDriver 2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e) on port 51929
Only local connections are allowed.
DevTools listening on ws://127.0.0.1:51932/devtools/browser/09ed1c7f-c33a-4f76-990b-943c6837d8d8
ChromeOptions options = new ChromeOptions();
var chromeDriverService = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
chromeDriverService.HideCommandPromptWindow = true;
chromeDriverService.SuppressInitialDiagnosticInformation = true;
options.AddArgument("headless");
options.AddArgument("--silent");
options.AddArgument("log-level=3");
IWebDriver driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),options);
I did suppress the logs by adding "options.AddArgument("log-level=3");". I am trying to avoid seeing below in my console, I need to suppress these messages too:
Starting ChromeDriver 2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e) on port 51929
Only local connections are allowed.
DevTools listening on ws://127.0.0.1:51932/devtools/browser/09ed1c7f-c33a-4f76-990b-943c6837d8d8"
Upvotes: 1
Views: 3681
Reputation: 36
You need to pass the chromeDriverService in the ChromeDriver constructor:
IWebDriver driver = new ChromeDriver(chromeDriverService, options);
Upvotes: 2