Hi Ravi,
Thanks for your reply!
The controls i use are all mapped in NameMapping.tcNM, some of the control properties does not exists when the control is in 'Window' type.
I also have my own WaitControlExist function which looks like below. Usually i'll wait for the control for 180 seconds. From automation log captures, the control i want already on screen within first 60 seconds, which means it failed to get synched in next 120 seconds.
How long will TC takes to get synched with test App? Can i trigger the synch event in script?
Thanks,
Ocean
function WaitControlExist(control, waitMilliseconds)
{
Log.Message(GetFunctionMsg(arguments));
var endTime = aqDateTime.AddSeconds(aqDateTime.Now(), waitMilliseconds / 1000);
while (aqDateTime.Now() <= endTime)
{
if (Exists(control))
{
Log.Message("Exists!");
return true;
}
else
{
//Log.Picture(Sys.Desktop, "Not exists!", "Capture in WaitControlExist inside while loop.", pmNormal);
Log.Message("Not exists!");
Delay(5000);
}
}
Log.Picture(Sys.Desktop, "Not exists!", "Capture in WaitControlExist outside while loop.", pmNormal);
return false;
}
function Exists(controlItem)
{
Log.PushLogFolder(Log.CreateFolder(GetFunctionName(arguments)));
try
{
Log.Message(GetFunctionMsg(arguments));
// Check if the name mapping item refers to an existing object
if (controlItem.WaitProperty("Exists", true, 2000))
{
return true;
}
else
{
// Refresh the mapping information to see if the object has been recreated
RefreshObjects();
return controlItem.WaitProperty("Exists", true, 2000);
}
}
finally
{
Log.PopLogFolder();
}
}
// Call this method if the object tree changes
function RefreshObjects()
{
Aliases.Refresh();
Aliases.RefreshMappingInfo();
}