예제 #1
0
        public WebBrowserInfo(string browserExecutablePath)
        {
            ExecutablePath = browserExecutablePath;

            FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(browserExecutablePath);

            Name    = GetBrowserName(versionInfo);
            Version = GetBrowserVersion(versionInfo);
            Is64Bit = Is64BitExecutable(browserExecutablePath);
            Id      = GetBrowserId(versionInfo);
        }
예제 #2
0
        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));
        }
예제 #3
0
 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)));
 }
예제 #5
0
 protected WebDriverUpdaterBase(WebBrowserId webBrowserId, IHttpWebRequestFactory webRequestFactory, IWebDriverUpdaterOptions webDriverUpdaterOptions)
 {
     this.webBrowserId            = webBrowserId;
     this.webRequestFactory       = webRequestFactory;
     this.webDriverUpdaterOptions = webDriverUpdaterOptions;
 }