I get generic error occurred in GDI+ for selenium webdriver.It was working fine still yesterday,But suddenly I get this error.
public string TakeScreenshot(IWebDriver driver, string SnapFolderPath, string TCID, string KeyFunction)
{
try
{
// driver.Manage().Window.Maximize();
ITakesScreenshot ssdriver = driver as ITakesScreenshot;
Screenshot screenshot = ssdriver.GetScreenshot();
string filePath = testReport + "\\" + TCID + "_" + KeyFunction + "_" + GetDateTimeforFilePath() + ".png";
screenshot.SaveAsFile(filePath, ImageFormat.Png);
return filePath;
}
catch (Exception ex)
{
return string.Empty;
}
}
Resolved this Issue .We need to give full access permission to the folder where we want to store the image.If we don't give full permission we get this error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With