public void OneTimeTearDown() { //ExtentManager.Instance.Flush(); if (ConfigurationManager.AppSettings["setvideorecording"].ToLower().Equals("true")) { rec.Dispose(); } DriverFactory.QuitDriver(driver); }
public void OneTimeSetUp() { GlobalVariables globalVariables = new GlobalVariables(); //initialize the global variables globalVariables.InitializeGlobalVariables(); if (ConfigurationManager.AppSettings["setvideorecording"].ToLower().Equals("true")) { string pth = System.Reflection.Assembly.GetCallingAssembly().CodeBase; string actualpath = pth.Substring(0, pth.LastIndexOf("bin")); string projectpath = new Uri(actualpath).LocalPath; string videopath = projectpath + ConfigurationManager.AppSettings["recordingpath"]; System.IO.Directory.CreateDirectory(videopath); string videoname = ConfigurationManager.AppSettings["application"] + "_" + GlobalVariables.environment + DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.ToString("HHmmss"); rec = new VideoRecorder(new RecorderParams(videopath + videoname, 5, SharpAvi.KnownFourCCs.Codecs.MotionJpeg, 40)); //DirectoryInfo dinfo = new DirectoryInfo(videopath); //long sizeofdirectory = DirSize(dinfo); //Console.WriteLine(sizeofdirectory); //if (sizeofdirectory / 1024 >= 2000) // File.Delete(); } //Create driver driver = DriverFactory.InitDriver(ConfigurationManager.AppSettings["platform"], GlobalVariables.browser, GlobalVariables.webdriverhost, GlobalVariables.webdriverport); if (driver != null) { ExtentTestManager.CreateParentTest(GetType().Name); log.Info("Parent Test created in Test report "); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(120)); if (GlobalVariables.platform.ToLower() == "win") { driver.Manage().Window.Maximize(); //driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(60); driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(70); DriverFactory.LoadApplication(driver); log.Info("Driver loaded and Application launch"); } } else { Console.WriteLine("Driver Not initialized"); log.Error("Driver is not loaded"); } }
public static void OneTimeSetUp() { InitializeGlobalVariables(); driver = DriverFactory.InitDriver(ConfigurationManager.AppSettings["platform"], ConfigurationManager.AppSettings["browser"], ConfigurationManager.AppSettings["webdriverhost"], ConfigurationManager.AppSettings["webdriverport"]); if (driver != null) { //ExtentTestManager.CreateParentTest(GetType().Name); log.Info("Parent Test created in Test report "); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); if (ConfigurationManager.AppSettings["platform"].ToLower() == "win") { driver.Manage().Window.Maximize(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15); DriverFactory.LoadApplication(driver); log.Info("Driver loaded and Application launch"); } } }