I am trying to use webdriver to save away an image of what would currently be in the dom, where some of the items may be 1500px+ in height. And so taking a screenshot of this doesn't help as at best I can get 1080. As when in testing it may well be lower.
I have tried researching and finding ways of doing this for most of the day, And thought I had Found something that would do the trick
var element = FindElement(By.ClassName("contentBody"));
int width = element.Size.Width;
int height = element.Size.Height;
Point point = element.Location;
int x = point.X;
int y = point.Y;
RectangleF part = new RectangleF(x, y, width, height);
Bitmap bmpobj = new Bitmap((int)part.Width, (int)part.Height);
Bitmap bn = bmpobj.Clone(part, bmpobj.PixelFormat);
bn.Save(path, ImageFormat.Png);
However I am getting an outofmemory exception when cloning the rectangle across. in this particular example the element is a div where the bounds are 1220 x 3045 (It is essentially a list of items) and I would like to save this away for comparisons later.
If anyone has any idea how to solve this your help would be greatly appreciated.