I have a situation when a modal dialog may or may not appear, depending on the state of the document displayed on the page. I'm trying to deal with the situation when the dialog does NOT appear. There is no ModalDialog exists() method that would meet my needs here. It would be helpful to have.
I've attached a class definition for a new unit test, based off of existing modaldialog test, along with a sample html file for it to use.
ZIP with test case class and test html file demonstrating problem
Logged In: YES
user_id=439149
Originator: YES
I noticed that WATIR recently (Feb-2007) added this method. http://svn.openqa.org/fisheye/browse/watir/trunk/watir/unittests/modal_dialog_test.rb
Logged In: YES
user_id=1081294
Originator: NO
Hi,
some code I use in a unit test might be of some use. (errorchecking not included)
using
com.jniwrapper.win32.ui.Wnd;
IE ie;
//create ie etc...
Wnd x = new Wnd(ie.iWebBrowser2().getHWND().getValue());
Wnd w =x.getWindow(Wnd.GW_HWNDNEXT | Wnd.GW_OWNER);
if ("Internet Explorer_TridentDlgFrame".equals(w.getWindowClassName())) {
//Modal exist
ModalDialog md = ie.modalDialog();
//work with modal
w.sendMessageEx(0x10, 0, 0); //Send Close Message to modal window, md.close() doesn't work for me...
}