@@ -15,15 +15,13 @@ public class DriverFactory
1515 {
1616 string driverPath ;
1717 string browserBinaryLocation ;
18- private Dictionary < Browser , Type > serviceTypes = new Dictionary < Browser , Type > ( ) ;
1918 private Dictionary < Browser , Type > optionsTypes = new Dictionary < Browser , Type > ( ) ;
2019
2120 public DriverFactory ( string driverPath , string browserBinaryLocation )
2221 {
2322 this . driverPath = driverPath ;
2423 this . browserBinaryLocation = browserBinaryLocation ;
2524
26- this . PopulateServiceTypes ( ) ;
2725 this . PopulateOptionsTypes ( ) ;
2826 }
2927
@@ -36,15 +34,6 @@ private void PopulateOptionsTypes()
3634 this . optionsTypes [ Browser . Safari ] = typeof ( SafariOptions ) ;
3735 }
3836
39- private void PopulateServiceTypes ( )
40- {
41- this . serviceTypes [ Browser . Chrome ] = typeof ( ChromeDriverService ) ;
42- this . serviceTypes [ Browser . Edge ] = typeof ( EdgeDriverService ) ;
43- this . serviceTypes [ Browser . Firefox ] = typeof ( FirefoxDriverService ) ;
44- this . serviceTypes [ Browser . IE ] = typeof ( InternetExplorerDriverService ) ;
45- this . serviceTypes [ Browser . Safari ] = typeof ( SafariDriverService ) ;
46- }
47-
4837 public event EventHandler < DriverStartingEventArgs > DriverStarting ;
4938
5039 public IWebDriver CreateDriver ( Type driverType , bool logging = false )
@@ -144,17 +133,6 @@ public IWebDriver CreateDriverWithOptions(Type driverType, DriverOptions driverO
144133
145134 this . OnDriverLaunching ( service , options ) ;
146135
147- if ( browser != Browser . All )
148- {
149- constructorArgTypeList . Add ( this . serviceTypes [ browser ] ) ;
150- constructorArgTypeList . Add ( this . optionsTypes [ browser ] ) ;
151- ConstructorInfo ctorInfo = driverType . GetConstructor ( constructorArgTypeList . ToArray ( ) ) ;
152- if ( ctorInfo != null )
153- {
154- return ( IWebDriver ) ctorInfo . Invoke ( new object [ ] { service , options } ) ;
155- }
156- }
157-
158136 driver = ( IWebDriver ) Activator . CreateInstance ( driverType , service ) ;
159137 return driver ;
160138 }
0 commit comments