public void TakeScreenshot(string fileName, string screenshotPath = null, IWebDriver driver = null)
{
Screenshot s = ((ITakesScreenshot)driver).GetScreenshot();//driver = new ChromeDriver();
var path = @"C:\Ashutosh";
if (!string.IsNullOrEmpty(screenshotPath))
{
path = screenshotPath;
}
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
s.SaveAsFile(Path.Combine(screenshotPath, fileName + DateTime.Now.ToString("MM-dd-yyyy-HHmmss")), ScreenshotImageFormat.Png);
}
{
Screenshot s = ((ITakesScreenshot)driver).GetScreenshot();//driver = new ChromeDriver();
var path = @"C:\Ashutosh";
if (!string.IsNullOrEmpty(screenshotPath))
{
path = screenshotPath;
}
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
s.SaveAsFile(Path.Combine(screenshotPath, fileName + DateTime.Now.ToString("MM-dd-yyyy-HHmmss")), ScreenshotImageFormat.Png);
}
No comments:
Post a Comment