2222using System . IO ;
2323using System . Text ;
2424
25+ #nullable enable
26+
2527namespace OpenQA . Selenium . IE
2628{
2729 /// <summary>
28- /// Exposes the service provided by the native IEDriverServer executable.
30+ /// Exposes the service provided by the native <c> IEDriverServer</c> executable.
2931 /// </summary>
3032 public sealed class InternetExplorerDriverService : DriverService
3133 {
3234 private const string InternetExplorerDriverServiceFileName = "IEDriverServer.exe" ;
3335
34- private InternetExplorerDriverLogLevel loggingLevel = InternetExplorerDriverLogLevel . Fatal ;
35- private string host = string . Empty ;
36- private string logFile = string . Empty ;
37- private string libraryExtractionPath = string . Empty ;
38- private string whitelistedIpAddresses = string . Empty ;
39-
4036 /// <summary>
4137 /// Initializes a new instance of the <see cref="InternetExplorerDriverService"/> class.
4238 /// </summary>
43- /// <param name="executablePath">The full path to the IEDriverServer executable.</param>
44- /// <param name="executableFileName">The file name of the IEDriverServer executable.</param>
45- /// <param name="port">The port on which the IEDriverServer executable should listen.</param>
46- private InternetExplorerDriverService ( string executablePath , string executableFileName , int port )
39+ /// <param name="executablePath">The full path to the <c> IEDriverServer</c> executable.</param>
40+ /// <param name="executableFileName">The file name of the <c> IEDriverServer</c> executable.</param>
41+ /// <param name="port">The port on which the <c> IEDriverServer</c> executable should listen.</param>
42+ private InternetExplorerDriverService ( string ? executablePath , string ? executableFileName , int port )
4743 : base ( executablePath , port , executableFileName )
4844 {
4945 }
@@ -55,57 +51,36 @@ protected override DriverOptions GetDefaultDriverOptions()
5551 }
5652
5753 /// <summary>
58- /// Gets or sets the value of the host adapter on which the IEDriverServer should listen for connections.
54+ /// Gets or sets the value of the host adapter on which the <c> IEDriverServer</c> should listen for connections.
5955 /// </summary>
60- public string Host
61- {
62- get { return this . host ; }
63- set { this . host = value ; }
64- }
56+ public string ? Host { get ; set ; }
6557
6658 /// <summary>
67- /// Gets or sets the location of the log file written to by the IEDriverServer.
59+ /// Gets or sets the location of the log file written to by the <c> IEDriverServer</c> .
6860 /// </summary>
69- public string LogFile
70- {
71- get { return this . logFile ; }
72- set { this . logFile = value ; }
73- }
61+ public string ? LogFile { get ; set ; }
7462
7563 /// <summary>
76- /// Gets or sets the logging level used by the IEDriverServer.
64+ /// Gets or sets the logging level used by the <c> IEDriverServer</c>. Defaults to <see cref="InternetExplorerDriverLogLevel.Fatal"/> .
7765 /// </summary>
78- public InternetExplorerDriverLogLevel LoggingLevel
79- {
80- get { return this . loggingLevel ; }
81- set { this . loggingLevel = value ; }
82- }
66+ public InternetExplorerDriverLogLevel LoggingLevel { get ; set ; } = InternetExplorerDriverLogLevel . Fatal ;
8367
8468 /// <summary>
85- /// Gets or sets the path to which the supporting library of the IEDriverServer.exe is extracted.
86- /// Defaults to the temp directory if this property is not set .
69+ /// Gets or sets the path to which the supporting library of the <c> IEDriverServer.exe</c> is extracted.
70+ /// Defaults to the temp directory if this property is <see langword="null"/> or <see cref="string.Empty"/> .
8771 /// </summary>
8872 /// <remarks>
89- /// The IEDriverServer.exe requires extraction of a supporting library to perform some of its functions. Setting
73+ /// The <c> IEDriverServer.exe</c> requires extraction of a supporting library to perform some of its functions. Setting
9074 /// This library is extracted to the temp directory if this property is not set. If the property is set, it must
9175 /// be set to a valid directory.
9276 /// </remarks>
93- public string LibraryExtractionPath
94- {
95- get { return this . libraryExtractionPath ; }
96- set { this . libraryExtractionPath = value ; }
97- }
77+ public string ? LibraryExtractionPath { get ; set ; }
9878
9979 /// <summary>
100- /// Gets or sets the comma-delimited list of IP addresses that are approved to
101- /// connect to this instance of the IEDriverServer. Defaults to an empty string,
102- /// which means only the local loopback address can connect.
80+ /// <para>Gets or sets the comma-delimited list of IP addresses that are approved to connect to this instance of the <c>IEDriverServer</c>.</para>
81+ /// <para>If <see langword="null"/> or <see cref="string.Empty"/>, only the local loopback address can connect.</para>
10382 /// </summary>
104- public string WhitelistedIPAddresses
105- {
106- get { return this . whitelistedIpAddresses ; }
107- set { this . whitelistedIpAddresses = value ; }
108- }
83+ public string ? WhitelistedIPAddresses { get ; set ; }
10984
11085 /// <summary>
11186 /// Gets the command-line arguments for the driver service.
@@ -115,29 +90,29 @@ protected override string CommandLineArguments
11590 get
11691 {
11792 StringBuilder argsBuilder = new StringBuilder ( base . CommandLineArguments ) ;
118- if ( ! string . IsNullOrEmpty ( this . host ) )
93+ if ( ! string . IsNullOrEmpty ( this . Host ) )
11994 {
120- argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -host={0}" , this . host ) ) ;
95+ argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -host={0}" , this . Host ) ) ;
12196 }
12297
123- if ( ! string . IsNullOrEmpty ( this . logFile ) )
98+ if ( ! string . IsNullOrEmpty ( this . LogFile ) )
12499 {
125- argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -log-file=\" {0}\" " , this . logFile ) ) ;
100+ argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -log-file=\" {0}\" " , this . LogFile ) ) ;
126101 }
127102
128- if ( ! string . IsNullOrEmpty ( this . libraryExtractionPath ) )
103+ if ( ! string . IsNullOrEmpty ( this . LibraryExtractionPath ) )
129104 {
130- argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -extract-path=\" {0}\" " , this . libraryExtractionPath ) ) ;
105+ argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -extract-path=\" {0}\" " , this . LibraryExtractionPath ) ) ;
131106 }
132107
133- if ( this . loggingLevel != InternetExplorerDriverLogLevel . Fatal )
108+ if ( this . LoggingLevel != InternetExplorerDriverLogLevel . Fatal )
134109 {
135- argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -log-level={0}" , this . loggingLevel . ToString ( ) . ToUpperInvariant ( ) ) ) ;
110+ argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -log-level={0}" , this . LoggingLevel . ToString ( ) . ToUpperInvariant ( ) ) ) ;
136111 }
137112
138- if ( ! string . IsNullOrEmpty ( this . whitelistedIpAddresses ) )
113+ if ( ! string . IsNullOrEmpty ( this . WhitelistedIPAddresses ) )
139114 {
140- argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -whitelisted-ips={0}" , this . whitelistedIpAddresses ) ) ;
115+ argsBuilder . Append ( string . Format ( CultureInfo . InvariantCulture , " -whitelisted-ips={0}" , this . WhitelistedIPAddresses ) ) ;
141116 }
142117
143118 if ( this . SuppressInitialDiagnosticInformation )
@@ -159,17 +134,17 @@ public static InternetExplorerDriverService CreateDefaultService()
159134 }
160135
161136 /// <summary>
162- /// Creates a default instance of the InternetExplorerDriverService using a specified path to the IEDriverServer executable.
137+ /// Creates a default instance of the InternetExplorerDriverService using a specified path to the <c> IEDriverServer</c> executable.
163138 /// </summary>
164- /// <param name="driverPath">The path to the executable or the directory containing the IEDriverServer executable.</param>
139+ /// <param name="driverPath">The path to the executable or the directory containing the <c> IEDriverServer</c> executable.</param>
165140 /// <returns>A InternetExplorerDriverService using a random port.</returns>
166141 public static InternetExplorerDriverService CreateDefaultService ( string driverPath )
167142 {
168143 string fileName ;
169144 if ( File . Exists ( driverPath ) )
170145 {
171146 fileName = Path . GetFileName ( driverPath ) ;
172- driverPath = Path . GetDirectoryName ( driverPath ) ;
147+ driverPath = Path . GetDirectoryName ( driverPath ) ! ;
173148 }
174149 else
175150 {
@@ -180,10 +155,10 @@ public static InternetExplorerDriverService CreateDefaultService(string driverPa
180155 }
181156
182157 /// <summary>
183- /// Creates a default instance of the InternetExplorerDriverService using a specified path to the IEDriverServer executable with the given name.
158+ /// Creates a default instance of the InternetExplorerDriverService using a specified path to the <c> IEDriverServer</c> executable with the given name.
184159 /// </summary>
185- /// <param name="driverPath">The directory containing the IEDriverServer executable.</param>
186- /// <param name="driverExecutableFileName">The name of the IEDriverServer executable file.</param>
160+ /// <param name="driverPath">The directory containing the <c> IEDriverServer</c> executable.</param>
161+ /// <param name="driverExecutableFileName">The name of the <c> IEDriverServer</c> executable file.</param>
187162 /// <returns>A InternetExplorerDriverService using a random port.</returns>
188163 public static InternetExplorerDriverService CreateDefaultService ( string driverPath , string driverExecutableFileName )
189164 {
0 commit comments