Skip to content

Commit e353672

Browse files
committed
Removing deprecated screenshot formats in .NET
1 parent 3690155 commit e353672

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

dotnet/src/webdriver/Screenshot.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,11 @@ public byte[] AsByteArray
9696
/// <param name="format">A <see cref="ScreenshotImageFormat"/> value indicating the format
9797
/// to save the image to.</param>
9898
public void SaveAsFile(string fileName, ScreenshotImageFormat format)
99-
{
100-
this.SaveAsFile(fileName, ConvertScreenshotImageFormat(format));
101-
}
102-
103-
/// <summary>
104-
/// Saves the screenshot to a file, overwriting the file if it already exists.
105-
/// </summary>
106-
/// <param name="fileName">The full path and file name to save the screenshot to.</param>
107-
/// <param name="format">A <see cref="System.Drawing.Imaging.ImageFormat"/> object indicating the format
108-
/// to save the image to.</param>
109-
[Obsolete("System.Drawing.Imaging.ImageFormat is not supported in .NET Core, and depending on it is being removed from WebDriver. Please convert to ScreenshotImageFormat.")]
110-
public void SaveAsFile(string fileName, ImageFormat format)
11199
{
112100
using (MemoryStream imageStream = new MemoryStream(this.byteArray))
113101
{
114102
Image screenshotImage = Image.FromStream(imageStream);
115-
screenshotImage.Save(fileName, format);
103+
screenshotImage.Save(fileName, ConvertScreenshotImageFormat(format));
116104
}
117105
}
118106

dotnet/test/common/TakesScreenshotTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void ShouldTakeScreenshotsOfThePage()
2020

2121
string filename = Path.Combine(Path.GetTempPath(), "snapshot" + new Random().Next().ToString() + ".png");
2222
Screenshot screenImage = screenshotCapableDriver.GetScreenshot();
23-
screenImage.SaveAsFile(filename, System.Drawing.Imaging.ImageFormat.Png);
23+
screenImage.SaveAsFile(filename, ScreenshotImageFormat.Png);
2424
Assert.IsTrue(File.Exists(filename));
2525
Assert.IsTrue(new FileInfo(filename).Length > 0);
2626
File.Delete(filename);

0 commit comments

Comments
 (0)