Example #1
0
        public UCIBrowser GetBrowser(BrowserOptions options, BrowserLoginDetails browserLoginDetails)
        {
            Logger.WriteLine("Getting Browser");
            if (!_browserCache.TryGetValue(options.BrowserType, out var dic))
            {
                Logger.WriteLine($"No browser for {options.BrowserType} doesn't exist. Creating new list");
                dic = new Dictionary <string, UCIBrowser>();
                _browserCache.Add(options.BrowserType, dic);
            }

            if (!dic.TryGetValue(browserLoginDetails.Username, out UCIBrowser browser))
            {
                Logger.WriteLine($"Browser for {browserLoginDetails.Username} doesn't exist. Creating new browser session");

                if (string.IsNullOrEmpty(options.DriversPath))
                {
                    options.DriversPath = GetDriverPath(options);
                }

                browser = new UCIBrowser(options, _buttonTexts, _appCache.Value);
                dic.Add(browserLoginDetails.Username, browser);
                browser.Login(browserLoginDetails);
            }
            return(browser);
        }
Example #2
0
        public UCIBrowser GetBrowser(BrowserOptions options, UserDetails userDetails, Uri uri)
        {
            Logger.WriteLine("Getting Browser");
            if (!_browserCache.TryGetValue(options.BrowserType, out var dic))
            {
                Logger.WriteLine($"No browser for {options.BrowserType} doesn't exist. Creating new list");
                dic = new Dictionary <string, UCIBrowser>();
                _browserCache.Add(options.BrowserType, dic);
            }

            if (!dic.TryGetValue(userDetails.Username, out UCIBrowser browser))
            {
                Logger.WriteLine($"Browser for {userDetails.Username} doesn't exist. Creating new browser session");

                browser = new UCIBrowser(options, _buttonTexts, _appCache.Value);
                dic.Add(userDetails.Username, browser);
                browser.Login(uri, userDetails);
            }
            return(browser);
        }