Beispiel #1
0
        public IWebDriver StartSession(WebDriverSettings settings)
        {
            if (_driver != null)
            {
                throw new InvalidOperationException("WebDriver instance was already created");
            }

            return(_driver = InitDriver(settings));
        }
Beispiel #2
0
        private IWebDriver InitLocalDriver(WebDriverSettings settings)
        {
            switch (settings.BrowserType)
            {
            case BrowserType.Chrome:
                return(new ChromeDriver());

            default:
                throw new InvalidOperationException($"Unsupported Browser Type: {settings.BrowserType}");
            }
        }
Beispiel #3
0
        private IWebDriver InitDriver(WebDriverSettings settings)
        {
            switch (settings.DriverType)
            {
            case DriverType.Local:
                return(InitLocalDriver(settings));

            case DriverType.Remote:
            default:
                throw new InvalidOperationException($"Unsupported Driver Type: {settings.DriverType}");
            }
        }