Skip to content

Commit

Permalink
Removed default BrowserVersion to preserve original behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
quigamdev committed Jun 3, 2024
1 parent 7fbc5e3 commit 54878f9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static ChromeDriver CreateChromeDriver(LocalWebBrowserFactory factory)
options.AddArgument("disable-popup-blocking");

options.AddArguments(factory.Capabilities);
options.BrowserVersion = factory.Options.TryGetOrDefault(nameof(options.BrowserVersion), "stable");
options.BrowserVersion = factory.Options.TryGet(nameof(options.BrowserVersion));

if (factory.GetBooleanOption("disableExtensions"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ namespace Riganti.Selenium.Core.Drivers.Implementation
public static class DictionaryExtensions
{

public static T2 TryGetOrDefault<T1, T2>(this IDictionary<T1, T2> dic, T1 key, T2 defaultValue)
public static T2 TryGet<T1, T2>(this IDictionary<T1, T2> dic, T1 key)
{
if (dic is not null && dic.TryGetValue(key, out T2 value) && value is T2)
{
return value;
}
return defaultValue;
return default;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static EdgeDriver CreateEdgeDriver(LocalWebBrowserFactory factory)
{
};

options.BrowserVersion = factory.Options.TryGetOrDefault(nameof(options.BrowserVersion), "stable");
options.BrowserVersion = factory.Options.TryGet(nameof(options.BrowserVersion));
return new EdgeDriver(options);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static FirefoxProfile GetFirefoxProfile()
public static FirefoxOptions GetFirefoxOptions(System.Collections.Generic.IDictionary<string, string> _options)
{
var options = new FirefoxOptions { Profile = GetFirefoxProfile() };
options.BrowserVersion = _options.TryGetOrDefault(nameof(options.BrowserVersion), "stable");
options.BrowserVersion = _options.TryGet(nameof(options.BrowserVersion));
return options;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static InternetExplorerDriver CreateInternetExplorerDriver(LocalWebBrowse
{
BrowserCommandLineArguments = "-private"
};
options.BrowserVersion = factory.Options.TryGetOrDefault(nameof(options.BrowserVersion), "stable");
options.BrowserVersion = factory.Options.TryGet(nameof(options.BrowserVersion));
return new InternetExplorerDriver(options);
}
}
Expand Down

0 comments on commit 54878f9

Please sign in to comment.