June 06, 2006

Watir Supports Modal Web Dialogs

About a year ago, It became clear that one of the major limitations of Watir was its lack of support for modal web dialogs. These are IE-specific popup windows that are drawn with the showModalDialog command. Unlike ordinary web popups, modals block access to the original web page until they are closed. You don't see them much on public web sites: they aren't compatable with non-IE browsers and and are arguably an example of poor user interface design. But they are very common with enterprise applications because they are easier to code. And these happen to be the kinds of applications that people often want to test with Watir.

Watir 1.5 includes support for these dialogs. To click an OK button on a modal dialog, you simply do:

  ie.modal_dialog.button(:text, "OK").click

We still haven't officially released 1.5. But it is pretty stable. You should take a look at it if you need modal web dialog support. My thanks to Yaxin Wang, David Schmidt and my collegues at DataCert for help with this feature.

Posted by bret at 09:53 PM | Comments (1)