Forum Discussion

steve_hall's avatar
steve_hall
Contributor
13 years ago

Event Handling in TC script produced by coding not recording

Hi All,



I have a TC script that recursively trawls the various controls in our test app, to produce some "object mapping" csv files, for use by manual testers. This script was written manually, as opposed to using recording - so lots of sys.process().form().client.... lines, no object mapping references etc etc.



However, SOME of the controls I trawl aren't yet coded in our application, and ... *BOOM* an error dialog appears.



I want to add event handling for such dialogs - but seemingly, given the way that our TC script was produced, "OnUnexpectedWindow" and "OnOverlappingWindow" are not useable events. 



Can someone suggest a way of implementing an "OnModalDialogBoxAppearing" event / handler?



Thanks





3 Replies

  • Thanks Tanya,



    In hindsight, I was being a little stupid - I was wanting the event to fire on the appearance of the unexpected window, without my script then trying to proceed(!).



    Anyway, that makes more sense now.



    However, can you now please explain....



    In the project properties window, there is the "On unexpected window" section, with the 6 checkbox options. My understanding is that 4 of these (click on focused controls, press esc, press enter, and send wm_close) should, one way or another, close the unexpected window. In fact, I had to add a "call window.close" to my unexpected window handler, as none of these 4 options closed the window.



    What am I misunderstanding here - what are these 4 options for?



    Thanks



    Steve




  • Hi Steve,


     


    If the OnUnexpectedWindow event handler isn't implemented in the project, TestComplete tries to close the window by doing the following actions (one by one if the previous step failed): it clicks on a focused button of the window, presses Esc, presses Enter and sends the WM_ClOSE command.