示例#1
0
        void InitDriver()
        {
            var dataPath = Directory.GetCurrentDirectory() + "/Data/";

            //Create default setting and options from driver
            ChromeOptions       options  = new ChromeOptions();
            ChromeDriverService services = ChromeDriverService.CreateDefaultService();

            //Set options
            options.AddArgument($"--user-data-dir={dataPath}");
            options.PageLoadStrategy = PageLoadStrategy.Normal;

            //Set settings
            services.HideCommandPromptWindow = true;

            driver = new ChromeDriver(services, options);

            Task.Run(() =>
            {
                session = driver.GetDevSession();

                //Block webvisor and metric requset
                session.AddBlockUrl("https://metrika.mos.ru",
                                    "https://mc.yandex.ru",
                                    "https://www.mos.ru/etp/SioprRest/getPeriod"); //Debug block url
            });
        }
示例#2
0
 protected WorkStepBase(IWebDriver driver)
 {
     this.driver = driver;
     session     = driver.GetDevSession();
 }