Skip to content

Commit

Permalink
fixed build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
raczeja committed Jul 9, 2018
1 parent b4fb9ad commit 0b4fbf6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Objectivity.Test.Automation.Common/Helpers/TakeScreenShot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,20 @@ public static string TakeScreenShotOfElement(int iframeLocationX, int iframeLoca

var image = new Rectangle(locationX, locationY, elementWidth, elementHeight);
var importFile = new Bitmap(filePath);
var newFilePath = Path.Combine(folder, screenshotName + ".jpeg");
var cloneFile = (Bitmap)importFile.Clone(image, importFile.PixelFormat);
string newFilePath;
Bitmap cloneFile;
try
{
newFilePath = Path.Combine(folder, screenshotName + ".jpeg");
cloneFile = (Bitmap)importFile.Clone(image, importFile.PixelFormat);
}
finally
{
importFile.Dispose();
}

Logger.Debug(CultureInfo.CurrentCulture, "Saving screenshot of element {0}", newFilePath);
cloneFile.Save(newFilePath);
importFile.Dispose();
File.Delete(filePath);
return newFilePath;
}
Expand Down

0 comments on commit 0b4fbf6

Please sign in to comment.