Your e-Business Quality Partner eValid™ -- Automated Web Quality Solution
Browser-Based, Client-Side, Functional Testing & Validation,
Load & Performance Tuning, Page Timing, Website Analysis,
and Rich Internet Application Monitoring.

Modal Dialog Boxes
eValid Home

Introduction
eValid is a powerful easy easy to use Test Enabled Web Browser that includes a special capability to to record Modal Dialog Boxes. Because Modal Dialog Boxes are a Windows system feature, and require focus to execute, some "special" techniques are used by eValid to successfully record a script that will play back successfully.

The ModalDialogWait 1000 and the Wait 1000
People process the necessary data to make a decision, such as a mouseClick, much slower than a computer does. This is evident when making a "real time" recording and being annoyed at the time it took to playback that script. One can then appreciate how much time it takes a person to make decisions using interactive Webpages. If one wants to know average usage time at his or her WebSite, then the latter is all and good. But if one is just interested in functionality and security, then scripts with long waits in them can become a nuisance to the person interested in verifying security and moving on to something else. That is why many people record a script straight, no real time, and add the waits later, if necessary, manually. I do this myself, quite often.

Because switching back and forth from Windows level to browser level wreaks havoc on synchronization issues, it is a good idea to put in some wait checks, Wait 1000/ ModalDialogWait 1000, at critical points in your script. As an example, let's say that you go to a page and a modal dialog box pops up for you to log in. So you go to the page InitLink URL if it's the initial link, GotoLink "URL" if it's a link somewhere else in the script. Right after the previous command is where it would be a good idea to put a ModalDialogWait 4000. You can put any number of milliseconds you want, but in my experience a 4 second, or 4000 milliseconds wait always holds the focus long enough for everything to happen as planned. You'll be surprised how quickly the modal dialog sequence executes, even with a four second wait.

So a typical Modal Dialog script may look like this:

InitLink "URL"
ModalDialogWait 4000
ModalDialogText "userName"
ModalDialogTab
ModalDialogText "passWord"
ModalDialogTab
ModalDialogTab
ModalDialogEnter
Wait 2000
ValidateSelectedText 86 0 "Login was incorrect. Please try again." ""
etc..

Notice that "Wait 2000" toward the end of the script? I'm sure you noticed other unfamiliar commands but we'll get to those later. That Wait 2000 is a regular eValid wait command. Why is that there? I mentioned earlier that Modal Dialog Boxes require the focus if you're going to interact with them. That means that eValid loses focus and therefore the reason why it's very difficult to record anything outside the browser. Remember, eValid is a test enabled Web browser. That also means it behaves just like a regular browser. When a browser losses focus, it doesn't do anything until it gets focus again. So by putting a regular wait in your script, it gives eValid a chance to re-synchronize so that the pass or fail page can download and then checks for the pass or fail text/URL/image for validation.

This technique isn't always necessary, but if you have a fast CPU, hard disk, and fast system memory, system calls, such as the Modal Dialog calls, can execute in the wink of an eye. > Processor time, not real time... So put a couple of waits in there, just to be sure.

ModalDialogTab and ModalDialogEnter
Because Modal Dialog Boxes are outside of the browser at the system level, recording clicks and input entries is near impossible because, again, your not clicking or inputting text inside the browser. Your putting text in a Windows' application, like NotePad, Even though Modal Dialogs are small and simple, they are Windows' apps, not Webpages. So to interact with the modal dialogs, we're going to use the Tab and Enter keys from the keyboard, instead of clicking the mouse. Let's briefly go over that script you saw earlier:

  1. InitLink "URL" > Go to this page
  2. ModalDialogWait 4000 > Wait 4 seconds to slow Windows down
  3. ModalDialogText "userName" > Enter userName
  4. ModalDialogTab > Tab to the passWord field
  5. ModalDialogText "passWord" > Enter the password
  6. ModalDialogTab > Tab to remember password checkbox
  7. ModalDialogTab > Tab to the OK button
  8. ModalDialogEnter > Hit Enter key to activate OK button
  9. Wait 2000 > Pause 2 seconds
  10. ValidateSelectedText 86 0 "Login was incorrect. Please try again." "" > Make sure "fail" page appears

The previous script, with your URL, UserName, and Password, would probably work great in most log-in scenarios. You see, that wasn't too bad, now was it?