I have a C# code which opens RDP - iexplore.exe of another server.
Now I have to scroll down the web page and take its screen shot, but on each scroll the image takes time to load. So when I take a screen shot on each scroll, sometimes the unloaded image gets saved.
I tried to put in a 1sec lag before taking the screenshot, but it isn't a full proof solution.
Is there any other way/event to check that the web-page/that portion has loaded?
Following is my code :
IHTMLElement2 scroller = null;
if (currentSnapshot.IsFullPage)
{
scroller = GetScrolledElement(dimensions);
}
if (scroller != null)
{
originalScrollPosition = scroller.scrollTop; //here's where we started to begin with
maxScrollPosition = Math.Max(scroller.clientHeight, scroller.scrollHeight);
scroller.scrollTop = 0; //start at the top
}
var screen = SnapshotHelper.CaptureArea(dimensions);
images.Add(screen);
Thread.Sleep(1000);
Application.DoEvents();
Thanks