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

Class SeleniumManager

dotnet/src/webdriver/Manager/SeleniumManager.cs:54–517  ·  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

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