views:

45

answers:

2

Hi,

I was wondering how you can test for the presence of a jQuery UI modal dialog with Selenium.

I have done some Google searching but nothing is abundantly clear. although this page suggested isVisible():

http://groups.google.com/group/selenium-test-tool/browse_thread/thread/6affc0ef45a1d4a6?pli=1

I would also require to test elements on the dialog and navigate back to the page that the dialog was initiated from.

Thanks in advance.

+3  A: 

I've worked on something similar in the past.

Assuming the modal is contained in a div, I'd start with a 'WaitForVisible' on that to wait until the modal is acutally showing. Then you can interact with the elements in the normal way, and then have a 'WaitForNotVisible' once you've finished with it.

If there isn't a convenient containing div, just pick some other element on the modal to wait for.

AlistairH
+2  A: 

The following works with the demo JQuery UI modal dialog at http://jqueryui.com/demos/dialog/

open | http://jqueryui.com/demos/dialog/
click | css=#demo-config-menu a:contains(Modal dialog)
waitForVisible | dialog-modal
assertText | ui-dialog-title-dialog-modal | Basic modal dialog
assertText | dialog-modal | Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.
click | css=.ui-dialog-titlebar-close
waitForNotVisible | dialog-modal
Dave Hunt