Skip to content

Commit

Permalink
[#262] addressed PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry.bogatko committed Sep 18, 2024
1 parent 5a06b8a commit b7e9be6
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected override DriverContext DriverContext
{
case BrowserName.Chrome:
case BrowserName.Yandex:
driverCtx = GetDriver<ChromeDriver>(() => ChromeDriverService.CreateDefaultService(),
driverCtx = GetDriverContext<ChromeDriver>(() => ChromeDriverService.CreateDefaultService(),
(ChromeOptions)driverSettings.DriverOptions, commandTimeout);
break;
case BrowserName.Firefox:
Expand All @@ -59,25 +59,25 @@ protected override DriverContext DriverContext
return geckoService;
};

driverCtx = GetDriver<FirefoxDriver>(geckoServiceProvider, (FirefoxOptions)driverSettings.DriverOptions, commandTimeout);
driverCtx = GetDriverContext<FirefoxDriver>(geckoServiceProvider, (FirefoxOptions)driverSettings.DriverOptions, commandTimeout);
break;
case BrowserName.IExplorer:
driverCtx = GetDriver<InternetExplorerDriver>(() => InternetExplorerDriverService.CreateDefaultService(),
driverCtx = GetDriverContext<InternetExplorerDriver>(() => InternetExplorerDriverService.CreateDefaultService(),
(InternetExplorerOptions)driverSettings.DriverOptions, commandTimeout);
break;
case BrowserName.Edge:
driverCtx = GetDriver<EdgeDriver>(() => EdgeDriverService.CreateDefaultService(),
driverCtx = GetDriverContext<EdgeDriver>(() => EdgeDriverService.CreateDefaultService(),
(EdgeOptions)driverSettings.DriverOptions, commandTimeout);
break;
case BrowserName.Opera:
var config = new OperaConfig();
var operaSettings = (OperaSettings)driverSettings;
var driverPath = new DriverManager().SetUpDriver(config, operaSettings.WebDriverVersion, operaSettings.SystemArchitecture);
driverCtx = GetDriver<ChromeDriver>(() => ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath), config.GetBinaryName()),
driverCtx = GetDriverContext<ChromeDriver>(() => ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath), config.GetBinaryName()),
(ChromeOptions)driverSettings.DriverOptions, commandTimeout);
break;
case BrowserName.Safari:
driverCtx = GetDriver<SafariDriver>(() => SafariDriverService.CreateDefaultService(),
driverCtx = GetDriverContext<SafariDriver>(() => SafariDriverService.CreateDefaultService(),
(SafariOptions)driverSettings.DriverOptions, commandTimeout);
break;
default:
Expand All @@ -88,7 +88,7 @@ protected override DriverContext DriverContext
}
}

private DriverContext GetDriver<T>(Func<DriverService> driverServiceProvider, DriverOptions driverOptions, TimeSpan commandTimeout) where T : WebDriver
private DriverContext GetDriverContext<T>(Func<DriverService> driverServiceProvider, DriverOptions driverOptions, TimeSpan commandTimeout) where T : WebDriver
{
var currentBrowserVersionRegex = new Regex(CurrentBrowserVersionPattern, RegexOptions.None, TimeoutConfiguration.Condition);
try
Expand Down

0 comments on commit b7e9be6

Please sign in to comment.