how to find an object by WndCaption property
Hi,
In my application I have to catch error message in order to close them for continue the script.
I choose several properties that caracterize these error message, but Test complete point on several objects that fill only a part of requirement.
For instance, script below (in jscript):
var PropArray = ("WndClass", "WndCaption", "Visible");
var ValArray = ("FXTopWindow", "Error message", true);
var error = Sys.Process("<application process name>").FindAllChildren(PropArray, ValArray, 3);
var error = (new VBArray(error)).toArray();
for (var i=0; i<error.length; i++)
Log.Message(error[i].FullName);
Assuming that 2 windows error are displayed (in my scenario), Script Test Log will display lot of windows that don't contain Caption "Error message".
Below some results displayed in Script Test Log, during this scenario:
Sys.Process("<application process name>").Window("FXTopWindow", "Error message", 1)
Sys.Process("<application process name>").Window("FXTopWindow", "<Parent Object WndCaption>", 51).Window("FXWindow", "", 1).Window("FXWindow", "", 1)
Sys.Process("<application process name>").Window("FXTopWindow", "<Parent Object WndCaption>", 51).Window("FXWindow", "", 5).Window("FXWindow", "", 1)
Two last objects displayed in this example have empty WndCaption in their properties.
In conclusion, I want to know how to filter these last objects and to obtain only object with WndCaption "Error message".
Regards
Yaacov
I found the mistake in my script:
I need to define PropArray and ValArray as array:
var PropArray = new Array ("WndClass", "WndCaption", "Visible");
var ValArray = new Array("FXTopWindow", "Error message", true);