From 6a9157f4382b0d43d3293b7152cc7b5c50fe3487 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Tue, 5 Aug 2025 18:21:44 +0200 Subject: [PATCH 1/4] [dotnet] Setting truncated logs on GeckoDriver --- dotnet/src/webdriver/Firefox/FirefoxDriverService.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs index 37c99b4927618..9276363189144 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs @@ -102,6 +102,11 @@ protected override DriverOptions GetDefaultDriverOptions() /// offer a way to specify a log file path directly. /// public string? LogPath { get; set; } + + /// + /// Disable truncation of long log lines in GeckoDriver. + /// + public bool LogTruncate { get; set; } /// /// Gets or sets the level at which log output is displayed. @@ -189,6 +194,11 @@ protected override string CommandLineArguments argsBuilder.Append(" --jsdebugger"); } + if (this.LogTruncate) + { + argsBuilder.Append(" --log-no-truncate"); + } + return argsBuilder.ToString().Trim(); } } From 2ce501204fbf31c622d373ac98d344cb75ef16c4 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Tue, 5 Aug 2025 19:20:02 +0200 Subject: [PATCH 2/4] Adding profile root as well --- .../src/webdriver/Firefox/FirefoxDriverService.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs index 9276363189144..a0e41816f39a4 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs @@ -107,6 +107,11 @@ protected override DriverOptions GetDefaultDriverOptions() /// Disable truncation of long log lines in GeckoDriver. /// public bool LogTruncate { get; set; } + + /// + /// Directory in which GeckoDriver creates profiles. + /// + public string? ProfileRoot { get; set; } /// /// Gets or sets the level at which log output is displayed. @@ -199,6 +204,16 @@ protected override string CommandLineArguments argsBuilder.Append(" --log-no-truncate"); } + if (!string.IsNullOrEmpty(this.ProfileRoot)) + { + if (!Directory.Exists(this.ProfileRoot)) + { + throw new ArgumentException($"Profile root directory does not exist: {this.ProfileRoot}", nameof(ProfileRoot)); + } + + argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --profile-root \"{0}\"", this.ProfileRoot); + } + return argsBuilder.ToString().Trim(); } } From cc5bc4bd479feedde2ba7211377852a8829adc94 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Tue, 5 Aug 2025 19:21:12 +0200 Subject: [PATCH 3/4] Format script --- dotnet/src/webdriver/Firefox/FirefoxDriverService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs index a0e41816f39a4..3ba03e3fd79bc 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs @@ -102,12 +102,12 @@ protected override DriverOptions GetDefaultDriverOptions() /// offer a way to specify a log file path directly. /// public string? LogPath { get; set; } - + /// /// Disable truncation of long log lines in GeckoDriver. /// public bool LogTruncate { get; set; } - + /// /// Directory in which GeckoDriver creates profiles. /// @@ -210,9 +210,9 @@ protected override string CommandLineArguments { throw new ArgumentException($"Profile root directory does not exist: {this.ProfileRoot}", nameof(ProfileRoot)); } - + argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --profile-root \"{0}\"", this.ProfileRoot); - } + } return argsBuilder.ToString().Trim(); } From ea1cd6300eef5cd860cf9273023bf19f92dedf39 Mon Sep 17 00:00:00 2001 From: Diego Molina Date: Tue, 5 Aug 2025 19:27:13 +0200 Subject: [PATCH 4/4] Improving property name --- dotnet/src/webdriver/Firefox/FirefoxDriverService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs index 3ba03e3fd79bc..da2ec12f282db 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxDriverService.cs @@ -106,7 +106,7 @@ protected override DriverOptions GetDefaultDriverOptions() /// /// Disable truncation of long log lines in GeckoDriver. /// - public bool LogTruncate { get; set; } + public bool LogNoTruncate { get; set; } /// /// Directory in which GeckoDriver creates profiles. @@ -199,7 +199,7 @@ protected override string CommandLineArguments argsBuilder.Append(" --jsdebugger"); } - if (this.LogTruncate) + if (this.LogNoTruncate) { argsBuilder.Append(" --log-no-truncate"); }