Forum Discussion
There are timing issues that can affect checking for Exists. Please take a look here:
https://support.smartbear.com/testcomplete/docs/app-objects/common-tasks/checking-existence.html
Thanks and even i tried giving wait , but its not working
if(Sys.Process("*").WaitWinFormsObject("DisplayScheduleMessage", 1000).Exists)
{
Sys.Process("*").WinFormsObject("DisplayScheduleMessage").Close();
}
else
{
Log.Message("Programme assigned");
}
- tristaanogre7 years agoEsteemed Contributor
Keep in mind that Sys.Process('*') will return the first process it finds in the search... which may not be your application. You need to specify what process in order to detect the Winform.
Also... you say, "It's not working"... can you be more specific? What is happening? Any errors? What's in the log?
Thanks!
i tried the below code and its working.
var w = Sys.Process().WaitWinFormsObject("DisplayScheduleMessage", 1000);
if(w.Exists && w.VisibleOnScreen)
{
}
else
{
}
- tristaanogre7 years agoEsteemed Contributor
Actually, I would change your line of code to
var w = Sys.Process('myApp').WaitWinFormsObject("DisplayScheduleMessage", 1000);Where you replace 'myApp' with the actual process name of your application under test. Sys.Process() will, again, not necessarily return your specific application.