Example #1
0
        public static IWebDriver GetInstance()
        {
            if (driver == null)
            {
                TestConfigurations configs = TestConfigurations.GetInstanse();

                if (TestConfigurations.Browser == chrome)
                {
                    ChromeOptions chromeOptions = new ChromeOptions();
                    string        FilePath      = @"C:\Users\Sofiya\Documents\Visual Studio 2017\Projects\DOCUMENT_UTILS\Download";
                    chromeOptions.AddUserProfilePreference("download.default_directory", FilePath);
                    chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");

                    driver = new ChromeDriver(chromeOptions);
                }
                else if (TestConfigurations.Browser == firefox)
                {
                    driver = new FirefoxDriver();
                }
                else if (TestConfigurations.Browser == internetExplorer)
                {
                    driver = new InternetExplorerDriver();
                }
                else
                {
                    throw new Exception("Invalid browser in the settings");
                }
            }
            return(driver);
        }
Example #2
0
 public static TestConfigurations GetInstanse()
 {
     if (configs == null)
     {
         GetConfigFilePath();
         GetConfigs();
         configs = new TestConfigurations();
     }
     return(configs);
 }