1919
2020using OpenQA . Selenium . Remote ;
2121using System ;
22- using System . Collections ;
2322using System . Collections . Generic ;
2423using System . Globalization ;
2524using System . Text . Json ;
26- using System . Text . Json . Nodes ;
2725
2826namespace OpenQA . Selenium
2927{
@@ -36,6 +34,7 @@ public class RemoteSessionSettings : ICapabilities
3634 private const string AlwaysMatchCapabilityName = "alwaysMatch" ;
3735
3836 private readonly List < string > reservedSettingNames = new List < string > ( ) { FirstMatchCapabilityName , AlwaysMatchCapabilityName } ;
37+ private DriverOptions mustMatchDriverOptions ;
3938 private List < DriverOptions > firstMatchOptions = new List < DriverOptions > ( ) ;
4039 private Dictionary < string , object > remoteMetadataSettings = new Dictionary < string , object > ( ) ;
4140
@@ -61,7 +60,7 @@ public RemoteSessionSettings()
6160 /// </param>
6261 public RemoteSessionSettings ( DriverOptions mustMatchDriverOptions , params DriverOptions [ ] firstMatchDriverOptions )
6362 {
64- this . MustMatchDriverOptions = mustMatchDriverOptions ;
63+ this . mustMatchDriverOptions = mustMatchDriverOptions ;
6564 foreach ( DriverOptions firstMatchOption in firstMatchDriverOptions )
6665 {
6766 this . AddFirstMatchDriverOption ( firstMatchOption ) ;
@@ -71,7 +70,7 @@ public RemoteSessionSettings(DriverOptions mustMatchDriverOptions, params Driver
7170 /// <summary>
7271 /// Gets a value indicating the options that must be matched by the remote end to create a session.
7372 /// </summary>
74- internal DriverOptions MustMatchDriverOptions { get ; private set ; }
73+ internal DriverOptions MustMatchDriverOptions => this . mustMatchDriverOptions ;
7574
7675 /// <summary>
7776 /// Gets a value indicating the number of options that may be matched by the remote end to create a session.
@@ -143,9 +142,9 @@ public void AddMetadataSetting(string settingName, object settingValue)
143142 /// <param name="options">The <see cref="DriverOptions"/> to add to the list of "first matched" options.</param>
144143 public void AddFirstMatchDriverOption ( DriverOptions options )
145144 {
146- if ( MustMatchDriverOptions != null )
145+ if ( this . mustMatchDriverOptions != null )
147146 {
148- DriverOptionsMergeResult mergeResult = MustMatchDriverOptions . GetMergeResult ( options ) ;
147+ DriverOptionsMergeResult mergeResult = this . mustMatchDriverOptions . GetMergeResult ( options ) ;
149148 if ( mergeResult . IsMergeConflict )
150149 {
151150 string msg = string . Format ( CultureInfo . InvariantCulture , "You cannot request the same capability in both must-match and first-match capabilities. You are attempting to add a first-match driver options object that defines a capability, '{0}', that is already defined in the must-match driver options." , mergeResult . MergeConflictOptionName ) ;
@@ -180,7 +179,7 @@ public void SetMustMatchDriverOptions(DriverOptions options)
180179 }
181180 }
182181
183- this . MustMatchDriverOptions = options ;
182+ this . mustMatchDriverOptions = options ;
184183 }
185184
186185 /// <summary>
@@ -238,7 +237,7 @@ public Dictionary<string, object> ToDictionary()
238237 capabilitiesDictionary [ remoteMetadataSetting . Key ] = remoteMetadataSetting . Value ;
239238 }
240239
241- if ( this . MustMatchDriverOptions != null )
240+ if ( this . mustMatchDriverOptions != null )
242241 {
243242 capabilitiesDictionary [ "alwaysMatch" ] = GetAlwaysMatchOptionsAsSerializableDictionary ( ) ;
244243 }
@@ -274,7 +273,7 @@ internal DriverOptions GetFirstMatchDriverOptions(int firstMatchIndex)
274273
275274 private IDictionary < string , object > GetAlwaysMatchOptionsAsSerializableDictionary ( )
276275 {
277- return this . MustMatchDriverOptions . ToDictionary ( ) ;
276+ return this . mustMatchDriverOptions . ToDictionary ( ) ;
278277 }
279278
280279 private List < object > GetFirstMatchOptionsAsSerializableList ( )
0 commit comments