コード例 #1
0
        public IWebDriver GetWebDriver(BrowserConfig cnf)
        {
            switch (cnf.Browser)
            {
            case AutomationEnums.Browser.Chrome:
                if (cnf.Device != AutomationEnums.Device.Laptop)
                {
                    return(Chrome(cnf));
                }
                else
                {
                    return(Chrome());
                }
                break;

            case AutomationEnums.Browser.Firefox:
                return(FireFox());

            case AutomationEnums.Browser.Edge:
                return(Edge());

            case AutomationEnums.Browser.IE:
                return(IE());

            case AutomationEnums.Browser.Safari:
                break;
            }
            throw new ArgumentException("Cannot find praticular web driver settings");
        }
コード例 #2
0
        private IWebDriver Chrome(BrowserConfig cnf)
        {
            ChromeDriverService chromeService = ChromeDriverService.CreateDefaultService(AutomationTestConfig.WebDriverLocation);

            chromeService.HideCommandPromptWindow = true;
            var options = new ChromeOptions();

            options.EnableMobileEmulation($"{cnf.Device.GetDescription()}");
            return(new ChromeDriver(chromeService, options));
        }