Skip to content

Commit e3255a6

Browse files
committed
Use logging in DriverFactory
1 parent 4681724 commit e3255a6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

dotnet/test/common/Environment/DriverFactory.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
using System.Reflection;
1010
using NUnit.Framework;
1111
using OpenQA.Selenium.Chromium;
12+
using OpenQA.Selenium.Internal.Logging;
1213

1314
namespace OpenQA.Selenium.Environment
1415
{
1516
public class DriverFactory
1617
{
18+
private static readonly ILogger log = Log.GetLogger<DriverFactory>();
19+
1720
string driverPath;
1821
string browserBinaryLocation;
1922
private Dictionary<Browser, Type> serviceTypes = new Dictionary<Browser, Type>();
@@ -55,6 +58,8 @@ public IWebDriver CreateDriver(Type driverType, bool logging = false)
5558

5659
public IWebDriver CreateDriverWithOptions(Type driverType, DriverOptions driverOptions, bool logging = false)
5760
{
61+
log.Info($"Creating driver of type {driverType}");
62+
5863
Browser browser = Browser.All;
5964
DriverService service = null;
6065
DriverOptions options = null;
@@ -180,7 +185,7 @@ protected void OnDriverLaunching(DriverService service, DriverOptions options)
180185
}
181186

182187

183-
private T MergeOptions<T>(object baseOptions, DriverOptions overriddenOptions) where T:DriverOptions, new()
188+
private T MergeOptions<T>(object baseOptions, DriverOptions overriddenOptions) where T : DriverOptions, new()
184189
{
185190
// If the driver type has a static DefaultOptions property,
186191
// get the value of that property, which should be a valid
@@ -202,15 +207,15 @@ protected void OnDriverLaunching(DriverService service, DriverOptions options)
202207
return mergedOptions;
203208
}
204209

205-
private T CreateService<T>() where T:DriverService
210+
private T CreateService<T>() where T : DriverService
206211
{
207212
T service = default(T);
208213
Type serviceType = typeof(T);
209214

210215
MethodInfo createDefaultServiceMethod = serviceType.GetMethod("CreateDefaultService", BindingFlags.Public | BindingFlags.Static, null, new Type[] { }, null);
211216
if (createDefaultServiceMethod != null && createDefaultServiceMethod.ReturnType == serviceType)
212217
{
213-
service = (T)createDefaultServiceMethod.Invoke(null, new object[] {});
218+
service = (T)createDefaultServiceMethod.Invoke(null, new object[] { });
214219
}
215220

216221
return service;

0 commit comments

Comments
 (0)