tmahender12
10 years agoFrequent Contributor
Event Handling
I created unexpected window event handler, now how to call that event handler, when error comes will it be automatically called?
Easy way of handling unexpected windows are from project properties see attachment
if you are using event handler you have to wite what to be dome when event fired..
this is an example I'm using
function Events_OnUnexpectedWindow(Sender, Window, LogParams){
var ErrMsg;
LogParams.Locked = true; //not to post error message
ErrMsg = 'the unexpected window is '+ Window.Name;
Log.Message(ErrMsg);
Log.Picture(Sys.Desktop.ActiveWindow());
if (Aliases.myApp.dlgWarning.OK.WaitProperty("Exists",true, 700)) {
Aliases.myApp.dlgWarning.OK.ClickButton();
return;
}
if (Aliases.myApp.dlgInformation.OK.WaitProperty("Exists",true, 700)) {
Aliases.myApp.dlgInformation.OK.ClickButton();
return;
}
if (Aliases.myApp.ConfirmDlg.Yes.WaitProperty("Exists",true, 700)) {
Aliases.myApp.ConfirmDlg.Yes.ClickButton();
return;
}
if (Aliases.myApp.ErrorDlg.OK.WaitProperty('Exists',true, 500)) {
Aliases.myApp.ErrorDlg.OK.ClickButton();
Runner.Stop(true);
}
}thanks for your reply, my application connects to cloud, if there is any network error it throws error saying "couldnot connect,Contact it support"
when iam executing the tests, the execution pauses at when the window comes, even though i wrote event handler like this, the excution does not goes to event handler
sub Events_OnUnexpectedWindow(Sender, Window, LogParams){
sys.process.Activatewindow
sys.window(client*).terminate()
}do i need to explicitly call the event handler, just if i write event handler is sufficeint?
wht do you get when you click view button in event page..?
that is where you hv to wright the handler
picture attached
when i click on view button, it takes to unit script, where i wrote event handler, but when the unexpected window appears the test never goes to event handler
Currently, TestComplete does not handle the following window types as unexpected:
Modal windows and dialogs implemented as windowless objects. That includes --
Modal windows in Flex applications (for example, those created using the PopUpManager class).
Modal windows in web applications (for example, those created using the div element or JavaScript).
ActionScript errors displayed by Flash Player.
Forms in mobile applications
See this