예제 #1
0
        private static Dictionary <string, object> GetDependencies()
        {
            var dic = new Dictionary <string, object>();

            var chromeOptions = new ChromeOptions();

            // ReSharper disable once HeuristicUnreachableCode
            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
#pragma warning disable 162
            if (Headless)
            {
                chromeOptions.AddArgument("--headless");
            }
            else
            {
                chromeOptions.AddArgument("start-maximized");
            }

            chromeOptions.SetLoggingPreference(LogType.Browser, LogLevel.Off);

#pragma warning restore 162
            Console.WriteLine("Instantiating Chrome driver...");
            var webDriver = new ChromeDriver(chromeOptions);
            dic.Add("ChromeDriver", webDriver);
            webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            var webDriverHelper = new WebDriverHelper(webDriver);
            dic.Add("WebDriverHelper", webDriverHelper);

            return(dic);
        }
예제 #2
0
 public UdemyDownloader(ChromeDriver webDriver,
                        WebDriverHelper helper)
 {
     _weDriver = webDriver ?? throw new ArgumentNullException(nameof(webDriver));
     _helper   = helper ?? throw new ArgumentNullException(nameof(helper));
 }