You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -80,14 +79,15 @@ bool TryGetDriverType(WebDriverCreationOptions options, IConfigurationSection co
80
79
}
81
80
catch(Exceptione)
82
81
{
83
-
logger.LogError(e,
84
-
"No implementation of {WebDriverIface} could be found for the {DriverTypeProp} '{DriverType}'; the driver configuration '{ConfigKey}' will be omitted. "+
85
-
"Reminder: If the driver type is not one which is shipped with Selenium then you must specify its assembly-qualified type name.",
86
-
nameof(IWebDriver),
87
-
nameof(WebDriverCreationOptions.DriverType),
88
-
options.DriverType,
89
-
configuration.Key);
90
-
returnfalse;
82
+
if(options.DriverFactoryType==null)
83
+
logger.LogError(e,
84
+
"No implementation of {WebDriverIface} could be found for the {DriverTypeProp} '{DriverType}'; the driver configuration '{ConfigKey}' will be omitted. "+
85
+
"Reminder: If the driver type is not one which is shipped with Selenium then you must specify its assembly-qualified type name.",
86
+
nameof(IWebDriver),
87
+
nameof(WebDriverCreationOptions.DriverType),
88
+
options.DriverType,
89
+
configuration.Key);
90
+
returnoptions.DriverFactoryType!=null?true:false;
91
91
}
92
92
}
93
93
@@ -110,25 +110,25 @@ bool TryGetDriverType(WebDriverCreationOptions options, IConfigurationSection co
"No type deriving from {OptionsBase} could be found for the combination of {WebDriverIface} {DriverType} and {OptionsTypeProp} '{OptionsType}'; the configuration '{ConfigKey}' will be omitted. "+
124
-
"See the exception details for more information.",
125
-
nameof(DriverOptions),
126
-
nameof(IWebDriver),
127
-
driverType.Name,
128
-
nameof(WebDriverCreationOptions.OptionsType),
129
-
options.OptionsType,
130
-
configuration.Key);
131
-
returnfalse;
120
+
if(options.DriverFactoryType==null)
121
+
logger.LogError(e,
122
+
"No type deriving from {OptionsBase} could be found for the combination of {WebDriverIface} {DriverType} and {OptionsTypeProp} '{OptionsType}'; the configuration '{ConfigKey}' will be omitted. "+
123
+
"See the exception details for more information.",
124
+
nameof(DriverOptions),
125
+
nameof(IWebDriver),
126
+
driverType?.Name,
127
+
nameof(WebDriverCreationOptions.OptionsType),
128
+
options?.OptionsType,
129
+
configuration.Key);
130
+
131
+
returnoptions.DriverFactoryType!=null?true:false;
132
132
}
133
133
134
134
try
@@ -138,12 +138,13 @@ bool TryGetOptionsType(WebDriverCreationOptions options, IConfigurationSection c
138
138
}
139
139
catch(Exceptione)
140
140
{
141
-
logger.LogError(e,
142
-
"An unexpected error occurred creating or binding to the {OptionsClass} type {OptionsType}; the configuration '{ConfigKey}' will be omitted.",
143
-
nameof(DriverOptions),
144
-
optionsType.FullName,
145
-
configuration.Key);
146
-
returnfalse;
141
+
if(options.DriverFactoryType==null)
142
+
logger.LogError(e,
143
+
"An unexpected error occurred creating or binding to the {OptionsClass} type {OptionsType}; the configuration '{ConfigKey}' will be omitted.",
/// An optional object which implements <see cref="ICustomizesOptions{TOptions}"/> for the corresponding <see cref="DriverOptions"/>
@@ -264,5 +275,10 @@ public class WebDriverCreationOptions
264
275
/// </para>
265
276
/// </remarks>
266
277
publicboolAddBrowserQuirks{get;set;}=true;
278
+
279
+
staticFunc<DriverOptions>GetUnsetOptionsFactory()
280
+
{
281
+
return()=>thrownewInvalidOperationException($"Driver options cannot be created via {nameof(OptionsFactory)}; either {nameof(DriverType)} must be set to a type which indicates a deterministic options type or {nameof(OptionsType)} must set set. If you are using a custom {nameof(DriverFactoryType)} then it may not be appropriate to create options in this way.");
0 commit comments