Forum Discussion
EvgenyTitov
8 years agoOccasional Contributor
Hi, there is no error , just exit after timeout.
public var WaitObject(var rootNode, string stringExp, double timeOutMilliSeconds)
{
var obj;
DateTime startTime = DateTime.Now;
obj = FindChild(rootNode, stringExp, "");
if (obj != null)
{
return obj;
}
while (timeOutMilliSeconds > ((int) (DateTime.Now - startTime).TotalMilliseconds))
{
obj = FindChild(rootNode, stringExp, "");
if (obj != null)
{
return obj;
}
Thread.Sleep(50);
}
return null;
}