Skip to content

Commit

Permalink
[dotnet] Fix saving png screenshot as file (#12654)
Browse files Browse the repository at this point in the history
Fix saving png screenshot as file
  • Loading branch information
nvborisenko committed Sep 1, 2023
1 parent a2cc4c9 commit 57503a5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dotnet/src/webdriver/Screenshot.cs
Expand Up @@ -103,10 +103,12 @@ public void SaveAsFile(string fileName, ScreenshotImageFormat format)
{
imageStream.WriteTo(fileStream);
}

using (Image screenshotImage = Image.FromStream(imageStream))
else
{
screenshotImage.Save(fileStream, ConvertScreenshotImageFormat(format));
using (Image screenshotImage = Image.FromStream(imageStream))
{
screenshotImage.Save(fileStream, ConvertScreenshotImageFormat(format));
}
}
}
}
Expand Down

0 comments on commit 57503a5

Please sign in to comment.