diff --git a/dotnet/src/webdriver/Firefox/FirefoxProfile.cs b/dotnet/src/webdriver/Firefox/FirefoxProfile.cs index a43fdf020f639..79d24501f1698 100644 --- a/dotnet/src/webdriver/Firefox/FirefoxProfile.cs +++ b/dotnet/src/webdriver/Firefox/FirefoxProfile.cs @@ -55,6 +55,7 @@ public class FirefoxProfile private bool acceptUntrustedCerts; private bool assumeUntrustedIssuer; private bool deleteSource; + private bool deleteOnClean = true; private Preferences profilePreferences; private Dictionary extensions = new Dictionary(); #endregion @@ -116,6 +117,16 @@ public string ProfileDirectory get { return this.profileDir; } } + /// + /// Gets or sets a value indicating whether to delete this profile after use with + /// the . + /// + public bool DeleteAfterUse + { + get { return this.deleteOnClean; } + set { this.deleteOnClean = value; } + } + /// /// Gets or sets a value indicating whether native events are enabled. /// @@ -303,7 +314,7 @@ public void WriteToDisk() /// is deleted. public void Clean() { - if (!string.IsNullOrEmpty(this.profileDir) && Directory.Exists(this.profileDir)) + if (this.deleteOnClean && !string.IsNullOrEmpty(this.profileDir) && Directory.Exists(this.profileDir)) { FileUtilities.DeleteDirectory(this.profileDir); }