public void ClearDriver()
        {
            if (TestContext.CurrentContext.Result.Outcome == ResultState.Success)
            {
                Logger.WhenTestSuccess();
            }

            if (TestContext.CurrentContext.Result.Outcome == ResultState.Failure ||
                TestContext.CurrentContext.Result.Outcome == ResultState.Error)
            {
                Logger.WhenTestFails();
                Logger.Log.Error("Test failed. Taking screenshot.");
                string screenFolder = AppDomain.CurrentDomain.BaseDirectory + @"\screens";
                Directory.CreateDirectory(screenFolder);
                var screen = Driver.TakeScreenshot();
                screen.SaveAsFile(screenFolder + @"\screen" + DateTime.Now.ToString("yy-MM-dd_hh-mm-ss") + ".png",
                                  ScreenshotImageFormat.Png);
                Logger.Log.Info("Took screenshot.");
            }

            DriverInstance.CloseBrowser();
        }
Ejemplo n.º 2
0
 public static void CloseBrowser()
 {
     DriverInstance.CloseBrowser();
 }
Ejemplo n.º 3
0
 public void CloseBrowser()
 {
     _driver = null;
     DriverInstance.CloseBrowser();
 }