Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A generic error occurred in GDI+ selenium webdriver

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;
        }
    }
like image 373
Pat Avatar asked Sep 11 '12 05:09

Pat


1 Answers

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

like image 196
Pat Avatar answered Sep 21 '22 06:09

Pat