|
var croppedImage = new Rectangle(pixelRatio * element.Location.X, pixelRatio * element.Location.Y, pixelRatio * element.Size.Width, pixelRatio * element.Size.Height); screenshot = screenshot.Clone(croppedImage, screenshot.PixelFormat); |
This line will throw a critical exception if the element overflows page, because it is attempting to crop more (element size) than the size of the bitmap (page size). See:
https://stackoverflow.com/questions/199468/c-sharp-image-clone-out-of-memory-exception
It might be beneficial to restrict the max size of the crop to bitmap size to avoid this.
AutomatedVisualTesting/AutomatedVisualTesting/Utilities/SeleniumDriver.cs
Line 178 in cfe62b4
This line will throw a critical exception if the element overflows page, because it is attempting to crop more (element size) than the size of the bitmap (page size). See: https://stackoverflow.com/questions/199468/c-sharp-image-clone-out-of-memory-exception
It might be beneficial to restrict the max size of the crop to bitmap size to avoid this.