public static void StartRecordingVideo(string scenarioTitle) { string VideoPath = Path.Combine(Directory.GetCurrentDirectory() + "\\ViedoRecords\\"); FilesManager.CreateFolder(VideoPath); string timestamp = DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss"); vidRec.OutputScreenCaptureFileName = VideoPath + scenarioTitle + " " + timestamp + ".mp4"; vidRec.Start(); }
public static void TakeScreenShot() { var takesScreenshot = Driver.WebDriver as ITakesScreenshot; string ScreenShootPath = Path.Combine(Directory.GetCurrentDirectory() + "\\ScreenShoots"); FilesManager.CreateFolder(ScreenShootPath); if (takesScreenshot != null) { var screenshot = takesScreenshot.GetScreenshot(); var tempFileName = Path.Combine(ScreenShootPath, Path.GetFileNameWithoutExtension(Path.GetTempFileName())) + ".jpg"; screenshot.SaveAsFile(tempFileName, ScreenshotImageFormat.Jpeg); Console.WriteLine($"SCREENSHOT[ file:///{tempFileName} ]SCREENSHOT"); } }