we are testing a library application using testpartner. There are 1 to 10 records in the application. we have created data test to display for the first 5 records. if there is no record, application will prompt alert message like "No record exists on this no".
In our data test 3rd record does not exist. When we are executing the script, when the application reaches to 3rd record, application prompts alert message. How to handle this situation? we have tried with mouse and Window events. But not success.
Our intention is handle 3rd record alert message,and continue the next record in the sequence.
If you want to handle unexpected popups then consider using an event monitor that keeps watching for the popup to be created. Note that in windows the dialog boxes belong to the windows system class #32770. A windows event can be used to watch out for what you call unexpected popup messages. I use this to handle any errors/validation messages within the target application. This solution should work for any popup messages that you get (and don't interact with). How would you like to handle the message box? What would you like TP to do when that happens?
If you always do what you've always done, you will always get what you've always got!
I had just asked a very similar question on the compuware discussion group and just had it answered, then found out about this site. The code that I was able to use to click on a pop up if it appears but skip the code if it doesn't was:
If VBWindow("Important Information VBWindow_0001", tpAttachNoWait).Exists = True Then
VBWindow("Important Information VBWindow_0001").Attach
However, I like the idea of an event monitor better so that I don't have to identify every place that a pop up could appear and add my code, now I just have to figure out how do it as I've only been using TP for about 2 weeks now.
The event monitor is a good way to deal with your specific issue. But you missed the point I was trying to make. I was trying to get you to think about your assumption that the popup was "unexpected". Try turning your thinking 180 and make the popup "expected" and it gives you a whole different thought process on how to construct the script.