Handling Popup Message Boxes

Popup Message Boxes are small dialog boxes that are launched (usually) from scripts in web pages. They display a simple message and sometimes offer buttons that allow the user to select a simple choice such as OK or Cancel. Badboy refers to this kind of window as a "Message Box".

Recording Message Boxes

If you are recording when a Message Box shows, Badboy will record a Message Box Item in your Script containing the details of the message that appeared and the user response. The figure below shows how this appears in your script:

Message Box Playback

Unlike most items in Badboy Scripts, Message Box Items don't cause Badboy to do anything immediately when they play. You might be surprised by this and think that the Message Box Item should show the Message Box itself. The reason it does not is that the appearance of the Message Box is usually a response to other items in your script - for example Requests, Mouse Clicks, Form Populators, JScript, or other items. Thus you do not need Message Box items to show Message Boxes - they will happen anyway.

What Message Box Items actually do when they play is to wait in the background for a Message Box to appear and then provide the response to it for you when that happens. This means that you don't have to push "Ok" or "Cancel" - Badboy does it for you according to how you have configured the Message Box Item. The script below shows an example of how a script might be constructed to respond to a Message Box using a Message Box Item:

After a Message Box Item has played, if a Message Box appears that matches it's message text you will see a slightly different kind of Message Box to usual. The figure below shows how this looks:

The modified Message Box that appears shows in the title bar the response that Badboy is going to supply and also the time remaining before the response will be provided in seconds. This enables you to watch and if you like, provide your own response manually - or otherwise let the Message Box time out and have Badboy provide the response.

Because Message Box Items instruct Badboy about how to respond to messages they must play prior to the item in your script that causes the message to appear. In some situations Badboy might record the Message Box Item after the item that makes the Message Box appear. In this case, just drag the Message Box Item up in the script so that it executes earlier until it executes before the Message Box appears.

Viewing Message Boxes in Responses

Badboy also records the appearance of Message Boxes as part of Responses in your script. Thus if you want to see whether a Message Box appeared or the response that was provided you can look at the responses for the item in your script that caused the message to show. The figure below shows a Message Box Item recorded as part of a Response.

Using Assertions with Message Boxes

If you want to check that a particular Message Box appears or ensure that it does not appear when your script is playing, you can use Assertions to do this. To make an Assertion operate on Message Boxes, enable the "Check against Message Boxes" option in the Assertion properties.

Badboy keeps track of all the Message Boxes that appear for a page and records their messages along with the page content. Thus when an Assertion plays, it checks the messages that have appeared on the page similarly to how it checks the content on the page. If the browser moves to a new page, however, Badboy will clear the messages accumulated and begin a fresh list of messages. Consequently, Assertions that you create must play against the same page that the Message Box you want to test appears on.


Badboy Documentation Generated on Mon Dec 29 22:28:42 EST 2008