Forum Discussion
North-E
16 years agoOccasional Contributor
Forgive me for posting here again. But my problem with closing all error messages is still actual. I am using external JS-script proposed higher with little modifications to handle more than one type of window. It works perfect with first type of windows (Visual Studio just-in-time debugger errors) in wndCaptions array but can't handle "Microsoft Visual C++ Runtime Library" windows though I thought it had worked before (I've attached it's screenshot). I determined that the script even couldn't find this window - warning message posts to TC's log only after I press "Ok" button by myself or activate any other application (error window disappears then).
I also read that using JS-script is obsolete and Runner.CallObjectMethodAsync() method could be used. But I still can't imagine how to apply this one to all my tests and all methods that could cause unexpected errors.
At the moment, I have no ideas of JS-script improvement or anything else... Probably, another external application should be written to attempt handling error windows.
P.S. Can you move the topic to another forum? I was inattentive posting this one (didn't see it's only for web testing).
var tcObj, wshShell, wndCaptions;
wndCaptions = new Array();
wndCaptions.push("Visual Studio");
wndCaptions.push("Microsoft Visual C++");
try
{
tcObj = GetObject("", "testcomplete.testcompleteapplication");
}
catch(e)
{
tcObj = null;
//return;
}
if (tcObj != null)
{
wshShell = new ActiveXObject("WScript.Shell");
while (tcObj.Integration.IsRunning())
{
for (var i = 0; i < wndCaptions.length; i++)
{
if (wshShell.AppActivate(wndCaptions))
{
/* Registering error window in TC's log */
tcObj.Integration.GetObjectByName("Log").Warning("\"" + wndCaptions + "\" was found in error window's caption");
wshShell.AppActivate(wndCaptions);
WScript.Sleep(1000);
wshShell.SendKeys("{ENTER}");
}
}
}
}
I also read that using JS-script is obsolete and Runner.CallObjectMethodAsync() method could be used. But I still can't imagine how to apply this one to all my tests and all methods that could cause unexpected errors.
At the moment, I have no ideas of JS-script improvement or anything else... Probably, another external application should be written to attempt handling error windows.
P.S. Can you move the topic to another forum? I was inattentive posting this one (didn't see it's only for web testing).
var tcObj, wshShell, wndCaptions;
wndCaptions = new Array();
wndCaptions.push("Visual Studio");
wndCaptions.push("Microsoft Visual C++");
try
{
tcObj = GetObject("", "testcomplete.testcompleteapplication");
}
catch(e)
{
tcObj = null;
//return;
}
if (tcObj != null)
{
wshShell = new ActiveXObject("WScript.Shell");
while (tcObj.Integration.IsRunning())
{
for (var i = 0; i < wndCaptions.length; i++)
{
if (wshShell.AppActivate(wndCaptions))
{
/* Registering error window in TC's log */
tcObj.Integration.GetObjectByName("Log").Warning("\"" + wndCaptions + "\" was found in error window's caption");
wshShell.AppActivate(wndCaptions);
WScript.Sleep(1000);
wshShell.SendKeys("{ENTER}");
}
}
}
}