Skip to content

Commit f00e838

Browse files
authored
[dotnet] Truncate log and set profile root in Firefox (GeckoDriver) (#16131)
* [dotnet] Setting truncated logs and profile root on GeckoDriver
1 parent cc88b00 commit f00e838

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

dotnet/src/webdriver/Firefox/FirefoxDriverService.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ protected override DriverOptions GetDefaultDriverOptions()
103103
/// </remarks>
104104
public string? LogPath { get; set; }
105105

106+
/// <summary>
107+
/// Disable truncation of long log lines in GeckoDriver.
108+
/// </summary>
109+
public bool LogNoTruncate { get; set; }
110+
111+
/// <summary>
112+
/// Directory in which GeckoDriver creates profiles.
113+
/// </summary>
114+
public string? ProfileRoot { get; set; }
115+
106116
/// <summary>
107117
/// Gets or sets the level at which log output is displayed.
108118
/// </summary>
@@ -189,6 +199,21 @@ protected override string CommandLineArguments
189199
argsBuilder.Append(" --jsdebugger");
190200
}
191201

202+
if (this.LogNoTruncate)
203+
{
204+
argsBuilder.Append(" --log-no-truncate");
205+
}
206+
207+
if (!string.IsNullOrEmpty(this.ProfileRoot))
208+
{
209+
if (!Directory.Exists(this.ProfileRoot))
210+
{
211+
throw new ArgumentException($"Profile root directory does not exist: {this.ProfileRoot}", nameof(ProfileRoot));
212+
}
213+
214+
argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --profile-root \"{0}\"", this.ProfileRoot);
215+
}
216+
192217
return argsBuilder.ToString().Trim();
193218
}
194219
}

0 commit comments

Comments
 (0)