Event not invoked..
I'm implementing Event handling for the first time.
When i clear cache of the browser, launch a website, enter username and password, a dilog 'Autocomplete passwords' is dispalyed asking for remember passowrd.
This occurs only when the browser cache is cleared.
So my requirement is to click on 'No' button on this dialog whenever thid dialog appears.
I've added an event control for this, Edited the event, added 'OnUnexpectedWindow' event to 'Events to handle'defined the routine.
Now i executed the script and the 'OnUnexpectedWindow' event is not invoked when the window is displayed.
Do i have to include anything in the script to invoke the event?
Re: Event not invoked..
How does TestComplete know if a window is unexpected ?
If it is trying to access a control, if it can't get to it, it tries again, and after some timeout if it still can't access it, it will assume that there is something blocking it (ie., an Unexpected dialog), and will trigger the OnUnexpectedWindow event. Note that the the unexpected window will have to be Modal (ie., it is blocking access to everything else).
After you entered the password, does your script click on the "Login" or "OK" button ? It has to be trying to do this when the auto-complete dialog appears. If it can't access the Login or Ok buttons because the auto-complete dialog appeared, then the OnUnexpectedWindow event should be triggered.
Note, if an unexpected window appears in your test, wouldn't you want to record that as an error for later investigation (eg., take screenshot, then click on the No button to close it)? You should reserve this OnUnexpectedWindow event for when a really unexpected window appears.
In your case, you can just Check if the Auto-Complete form is open, and if it is, click on the No button, if not, then do the next step in the script. In our tests, we do something like this :
call EnterLoginName ("itsme")
call EnterPassword ("mypw")
call autocompClickNoIfOpen 'Check that autocomplete dialog is open and if it is, click No btn, else just exit without errors