diff --git a/dotnet/src/webdriver/Chromium/ChromiumDriverLogLevel.cs b/dotnet/src/webdriver/Chromium/ChromiumDriverLogLevel.cs new file mode 100644 index 0000000000000..4e87858b065f3 --- /dev/null +++ b/dotnet/src/webdriver/Chromium/ChromiumDriverLogLevel.cs @@ -0,0 +1,61 @@ +// +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +namespace OpenQA.Selenium.Chromium; + +/// +/// Represents the valid values of logging levels available with the Chromium based drivers. +/// +public enum ChromiumDriverLogLevel +{ + /// + /// Represents the value All, the most detailed logging level available. + /// + All, + + /// + /// Represents the Debug value + /// + Debug, + + /// + /// Represents the Info value + /// + Info, + + /// + /// Represents the Warning value + /// + Warning , + + /// + /// Represents the Severe value + /// + Severe, + + /// + /// Represents the Off value, nothing gets logged + /// + Off, + + /// + /// Represents that the logging value is unspecified, and should be the default level. + /// + Default +} diff --git a/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs b/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs index 9c10e635d8df8..44c9f4d41bee9 100644 --- a/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs +++ b/dotnet/src/webdriver/Chromium/ChromiumDriverService.cs @@ -84,6 +84,11 @@ protected ChromiumDriverService(string? executablePath, string? executableFileNa /// public bool EnableAppendLog { get; set; } + /// + /// Gets or sets the level at which log output is displayed. + /// + public ChromiumDriverLogLevel LogLevel { get; set; } = ChromiumDriverLogLevel.Default; + /// /// Gets or sets the comma-delimited list of IP addresses that are approved to connect to this instance of the Chrome driver. /// A value of or means only the local loopback address can connect. @@ -154,6 +159,15 @@ protected override string CommandLineArguments argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " -allowed-ips={0}", this.AllowedIPAddresses)); } + if (this.LogLevel != ChromiumDriverLogLevel.Default) + { + if (Enum.IsDefined(typeof(ChromiumDriverLogLevel), this.LogLevel)) + { + argsBuilder.Append(string.Format(CultureInfo.InvariantCulture, " --log-level={0}", this.LogLevel.ToString().ToUpperInvariant())); + } + } + + return argsBuilder.ToString(); } }