MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / SeleniumManager

Class SeleniumManager

dotnet/src/webdriver/Manager/SeleniumManager.cs:52–523  ·  view source on GitHub ↗

Manages automatic discovery and configuration of browser drivers. Warning: This is an experimental API that is subject to change in future versions. Selenium Manager automatically locates or downloads the appropriate browser driver for the specified browser. It eliminates the need for manual driver management by: <desc

Source from the content-addressed store, hash-verified

50/// </para>
51/// </remarks>
52public static partial class SeleniumManager
53{
54 private static readonly ILogger _logger = Log.GetLogger(typeof(SeleniumManager));
55
56 // This logic to find the Selenium Manager binary is complex due to supporting multiple deployment scenarios.
57 // Once Selenium Manager becomes a true native library (dll, so, dylib),
58 // we will be able to reference it directly from the .NET bindings, and this logic will be removed.
59 private static readonly Lazy<string> _lazyBinaryFullPath = new(() =>
60 {
61 if (_logger.IsEnabled(LogEventLevel.Debug))
62 {
63 _logger.Debug("Locating Selenium Manager executable binary...");
64 }
65
66 string? binaryFullPath = Environment.GetEnvironmentVariable("SE_MANAGER_PATH");
67
68 if (binaryFullPath is not null)
69 {
70 if (!File.Exists(binaryFullPath))
71 {
72 throw new FileNotFoundException($"Unable to locate provided Selenium Manager binary at '{binaryFullPath}'.");
73 }
74
75 return binaryFullPath;
76 }
77
78#if NET8_0_OR_GREATER
79 SupportedPlatform? platform = null;
80
81 if (OperatingSystem.IsWindows())
82 {
83 platform = SupportedPlatform.Windows;
84 }
85 else if (OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD())
86 {
87 platform = SupportedPlatform.Linux;
88 }
89 else if (OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst())
90 {
91 platform = SupportedPlatform.MacOS;
92 }
93#elif NETSTANDARD2_0
94 SupportedPlatform? platform = null;
95
96 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
97 {
98 platform = SupportedPlatform.Windows;
99 }
100 else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
101 {
102 platform = SupportedPlatform.Linux;
103 }
104 else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
105 {
106 platform = SupportedPlatform.MacOS;
107 }
108#elif NET462
109 var platform = SupportedPlatform.Windows;

Callers

nothing calls this directly

Calls 7

SelectMethod · 0.80
SplitMethod · 0.80
GetLoggerMethod · 0.45
IsEnabledMethod · 0.45
DebugMethod · 0.45
AddMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected