public WebBrowserInfo(string browserExecutablePath)
        {
            ExecutablePath = browserExecutablePath;

            FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(browserExecutablePath);

            Name    = GetBrowserName(versionInfo);
            Version = GetBrowserVersion(versionInfo);
            Is64Bit = Is64BitExecutable(browserExecutablePath);
            Id      = GetBrowserId(versionInfo);
        }
        private static IWebBrowserInfo GetWebBrowserInfoFromUserChoiceKey()
        {
            WebBrowserId id = WebBrowserId.Unidentified;

            using (RegistryKey userChoiceKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice", writable: false)) {
                if (!(userChoiceKey is null))
                {
                    string progId = (string)userChoiceKey.GetValue("Progid");

                    if (!string.IsNullOrEmpty(progId))
                    {
                        switch (progId)
                        {
                        case "AppXq0fevzme2pys62n3e0fbqa7peapykr8v":
                            id = WebBrowserId.Edge;
                            break;

                        case "ChromeHTML":
                            id = WebBrowserId.Chrome;
                            break;

                        case "FirefoxURL":
                            id = WebBrowserId.Firefox;
                            break;

                        case "IE.HTTP":
                            id = WebBrowserId.InternetExplorer;
                            break;

                        case "OperaStable":
                            id = WebBrowserId.Opera;
                            break;

                        case "SafariHTML":
                            id = WebBrowserId.Safari;
                            break;

                        default:
                            id = WebBrowserId.Unidentified;
                            break;
                        }
                    }
                }
            }

            return(id == WebBrowserId.Unidentified ? null : GetWebBrowserInfo(id));
        }
 public static IWebBrowserInfo GetWebBrowserInfo(WebBrowserId webBrowserId, bool useCachedResult = true)
 {
     return(GetWebBrowserInfo(useCachedResult).Where(info => info.Id == webBrowserId)
            .OrderByDescending(info => info.Is64Bit)
            .FirstOrDefault());
 }
示例#4
0
 public static IWebDriver Create(this IWebDriverFactory webDriverFactory, WebBrowserId webBrowserId)
 {
     return(webDriverFactory.Create(WebBrowserInfoFactory.Default.GetInfo(webBrowserId)));
 }
 protected WebDriverUpdaterBase(WebBrowserId webBrowserId, IHttpWebRequestFactory webRequestFactory, IWebDriverUpdaterOptions webDriverUpdaterOptions)
 {
     this.webBrowserId            = webBrowserId;
     this.webRequestFactory       = webRequestFactory;
     this.webDriverUpdaterOptions = webDriverUpdaterOptions;
 }