public SeleniumTaskScheduler(SeleniumConfiguration configuration, ILogger logger)
 {
     _logger        = logger;
     _tasks         = new BlockingCollection <SeleniumTask>();
     _configuration = configuration;
     _isRunning     = false;
 }
Ejemplo n.º 2
0
        public SeleniumWorker(SeleniumConfiguration configuration, ILogger logger, CancellationToken token)
        {
            var isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
            var options = new ChromeOptions();

            if (isLinux)
            {
                options.BinaryLocation = "/usr/bin/google-chrome-stable";
                options.AddArguments("--no-sandbox", "--disable-gpu", "--disable-dev-shm-usage");
            }
            if (configuration.Headless)
            {
                options.AddArgument("headless");
            }
            _driver = new ChromeDriver(AppDomain.CurrentDomain.BaseDirectory, options);
            _logger = logger;
            _token  = token;
        }