Example #1
0
        internal void InitializeTest()
        {
            ReportUtil.AddTestcaseDetailsToExtentReport();
            browser = ConfigurationManager.AppSettings["Browser"].ToLower();
            url     = ConfigurationManager.AppSettings["URL"];
            switch (browser)
            {
            case "chrome":
                driver = new ChromeDriver();
                break;

            case "firefox":
                driver = new FirefoxDriver();
                break;

            case "ie":
                driver = new InternetExplorerDriver();
                break;

            default:
                throw new Exception("Browser name is not properly mentioned in the App.config file.");
            }
            driver.Manage().Window.Maximize();
            driver.Url = url;
            int waitTime = Convert.ToInt32(ConfigurationManager.AppSettings["WaitTime"]);

            wait           = new WebDriverWait(driver, TimeSpan.FromSeconds(waitTime));
            ScreenshotUtil = new ScreenshotUtil(driver);
        }