I have this code snippet that needs to retrieve the document object of an iframe and save it in an object.
//just a wrapper object to store the document object
DocObj obj = new DocObj(HtmlDoc);
ManualResetEvent aDoneEvents = new ManualResetEvent(false);
string errorMessage = "";
Thread aThread = new Thread(() =>
{
try
{
//finding the iframe element in the current document
IHTMLElement IElem = LocatorBuilder.GetLocator(Target)
.Find(this.HTMLDoc);
obj.HTMLDoc = (IElem as HTMLIFrame).document as HTMLDocument;
}
catch (Exception e)
{
errorMessage = e.Message;
}
aDoneEvents.Set();
});
aThread.SetApartmentState(ApartmentState.STA);
aThread.IsBackground = true;
aThread.Start();
aDoneEvents.WaitOne();
if (errorMessage != "")
{
throw new Exception(errorMessage);
}
HtmlDoc = obj.HTMLDoc;
But when I try to retrieve the new document object I get this exception on the last line:
Function evaluation disabled because a previous function evaluation timed out. You must continue execution to reenable function evaluation