Exemplo n.º 1
0
        private DriverOptions DetermineBrowser(BrowserType browser, string testDetails)
        {
            if (browser == BrowserType.Chrome)
            {
                ChromeOptions chromeOptions = new ChromeOptions();
                chromeOptions.AddBrowserCapabilities(browser, testDetails);
                Options = chromeOptions;
            }
            else if (browser == BrowserType.Firefox)
            {
                FirefoxOptions ffOptions = new FirefoxOptions();
                ffOptions.AddBrowserCapabilities(browser, testDetails);
                Options = ffOptions;
            }
            else if (browser == BrowserType.MicrosoftEdge || browser == BrowserType.Safari)
            {
                switch (browser)
                {
                case BrowserType.MicrosoftEdge:
                    Options = new EdgeOptions();
                    break;

                case BrowserType.Safari:
                    Options = new SafariOptions();
                    break;
                }

                Options.AddBrowserCapabilities(browser, testDetails);
            }
            else
            {
                log.Debug("Unrecognized browser type specified ...defaulting to Chrome");
                ChromeOptions chromeOptions = new ChromeOptions();
                chromeOptions.AddBrowserCapabilities(browser, testDetails);
                Options = chromeOptions;
            }
            return(Options);
        }