@@ -53,22 +53,22 @@ static SeleniumManager()
5353#if NET45 || NET46 || NET47
5454 binary = "selenium-manager/windows/selenium-manager.exe" ;
5555#else
56- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
57- {
58- binary = "selenium-manager/windows/selenium-manager.exe" ;
59- }
60- else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
61- {
62- binary = "selenium-manager/linux/selenium-manager" ;
63- }
64- else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
65- {
66- binary = "selenium-manager/macos/selenium-manager" ;
67- }
68- else
69- {
70- throw new WebDriverException ( "Selenium Manager did not find supported operating system" ) ;
71- }
56+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
57+ {
58+ binary = "selenium-manager/windows/selenium-manager.exe" ;
59+ }
60+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
61+ {
62+ binary = "selenium-manager/linux/selenium-manager" ;
63+ }
64+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
65+ {
66+ binary = "selenium-manager/macos/selenium-manager" ;
67+ }
68+ else
69+ {
70+ throw new WebDriverException ( "Selenium Manager did not find supported operating system" ) ;
71+ }
7272#endif
7373
7474 binaryFullPath = Path . Combine ( currentDirectory , binary ) ;
@@ -111,14 +111,11 @@ private static string BrowserBinary(DriverOptions options)
111111 string [ ] vendorOptionsCapabilities = { "moz:firefoxOptions" , "goog:chromeOptions" , "ms:edgeOptions" } ;
112112 foreach ( string vendorOptionsCapability in vendorOptionsCapabilities )
113113 {
114- try
115- {
116- Dictionary < string , object > vendorOptions = capabilities . GetCapability ( vendorOptionsCapability ) as Dictionary < string , object > ;
117- return vendorOptions [ "binary" ] as string ;
118- }
119- catch ( Exception )
114+ IDictionary < string , object > vendorOptions = capabilities . GetCapability ( vendorOptionsCapability ) as IDictionary < string , object > ;
115+
116+ if ( vendorOptions != null && vendorOptions . TryGetValue ( "binary" , out object browserBinaryPath ) )
120117 {
121- // no-op, it would be ideal to at least log the exception but the C# do not log anything at the moment
118+ return browserBinaryPath as string ;
122119 }
123120 }
124121
0 commit comments