public override IWebDriver LocalDriver(object options) { var driverFolder = Environment.GetEnvironmentVariable("IEWebDriver"); InternetExplorerDriverService driverService = null; IWebDriver driver; try { driverService = GetDefaultService <InternetExplorerDriverService>(driverFolder); var ieOptions = options == null?InternetExplorerOptions() : (InternetExplorerOptions)options; driver = new InternetExplorerDriver(driverService, ieOptions, Timeout); } catch { driverService?.Dispose(); throw; } return(driver); }