a new ModalDialog window from ModalDialog

18 views
Skip to first unread message

Kevin

unread,
Dec 4, 2009, 3:07:35 AM12/4/09
to watij
If there is a ModalDialog from an IE windows, i can use ModalDialog
modalDialog = ie.modalDialog() to get modalDialog object, and then use
modalDialog handler to operate. How can i do if there are another
ModalDialog which will popup from a ModalDialog?

Adrian Ghidu

unread,
Dec 4, 2009, 2:42:47 PM12/4/09
to wa...@googlegroups.com
Same method should be called: ie.modalDialog().


--

You received this message because you are subscribed to the Google Groups "watij" group.
To post to this group, send email to wa...@googlegroups.com.
To unsubscribe from this group, send email to watij+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/watij?hl=en.



Kevin

unread,
Dec 7, 2009, 8:43:16 PM12/7/09
to watij

Thanks Adrian. I've tried called: ie.modalDialog(), but I still can't
get the modalDialog object. In my case, a modalDialog window popup
from ie, i can get the modalDialog object by calling ie.modalDialog
(), but if there is another modalDialog popuped from the modalDialog
window, the mothod ie.modalDialog desn't work. :-(

Adrian Ghidu wrote:
> Same method should be called: ie.modalDialog().
>
> On Fri, Dec 4, 2009 at 10:07 AM, Kevin <kevin.f...@gmail.com> wrote:
>
> > If there is a ModalDialog from an IE windows, i can use ModalDialog
> > modalDialog = ie.modalDialog() to get modalDialog object, and then use
> > modalDialog handler to operate. How can i do if there are another
> > ModalDialog which will popup from a ModalDialog?
> >
> > --
> >
> > You received this message because you are subscribed to the Google Groups
> > "watij" group.
> > To post to this group, send email to wa...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > watij+un...@googlegroups.com <watij%2Bunsu...@googlegroups.com>.

Adrian Ghidu

unread,
Dec 8, 2009, 8:00:35 AM12/8/09
to wa...@googlegroups.com
Kevin,
Can you describe what happens? Do you get a timeout exception or the old previous modal dialog is returned?
I'm currently working with multiple modal dialogs open.

Regards
Adrian

To unsubscribe from this group, send email to watij+un...@googlegroups.com.

Kevin

unread,
Dec 10, 2009, 9:15:48 PM12/10/09
to watij
Thanks Adrian,Sorry for replying so late, because the network problem,
sometime i can't access this site.
----------------------------------------------------
I post some of my code here:
IE ie = new IE();
ie.start(url);
ie.bringToFront();
ie.maximize();
...
new Thread(new Runnable() {
public void run() {
try {

ie.frame("wind").frame("main").div
(id,"pcButtons").form(id,"controlForm").table(1).body(0).cell
(0,2).image(0).click();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();


ModalDialog modalDialog = ie.modalDialog();
....

final ModalDialog modalDialog2 = modalDialog;
new Thread(new Runnable() {
public void run() {
try {
modalDialog2.frame(0).div
(id,"formHolder").form(id,"theForm").table(1).body(0).image(4).click
();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();

ModalDialog modalDialog_child = ie.modalDialog();

System.out.println(modalDialog_child.html());


I debuged at line ModalDialog modalDialog_child = ie.modalDialog();
found that the thread hanged up at the line "webBrowser.waitReady
(timeMillis)" of IE class

private void doWaitUntilReady(long timeMillis) throws Exception {
Debug.getInstance().println("Begin IE.doWaitUntilReady(long
timeMillis)");
webBrowser.waitReady(timeMillis);
waitUntilDocumentInitializedAndComplete();
Debug.getInstance().println("End IE.doWaitUntilReady(long
timeMillis)");
}


I didn't get a timeout exception and also can get the old previous
modal dialog.

Many thanks,
Kevin
> > watij%2Bunsu...@googlegroups.com<watij%252Buns...@googlegroups.com>

Adrian Ghidu

unread,
Dec 11, 2009, 6:59:50 AM12/11/09
to wa...@googlegroups.com
Hi Kevin,
If your second ie.modalDialog() call returns the same modal dialog, this changes everything. When you're making this call, is the second dialog open? How sure are you this is a modal dialog and not a modeless one? While this second dialog is open can you work on the previous one? The modalDialog method works with message loop and so it cannot catch modeless dialogs.

Regards

To unsubscribe from this group, send email to watij+un...@googlegroups.com.

Kevin

unread,
Dec 13, 2009, 10:19:38 PM12/13/09
to watij
Hi Adrian,

I'm sure that when i made the second call ie.modalDialog(), the second
dialog is opening.
Also i'm sure the second dialog is modal dialog, because i can do
nothing on the previous dialog if the second one is opening.
So it seems the ie.modalDialog method can't catch the second modal
dialog. :-(
Do you know any methods/workaround can handle this situation?

Many thanks,
Kevin
> > > On Tue, Dec 8, 2009 at 3:43 AM, Kevin <kevin.feng.g...@gmail.com> wrote:
>
> > > > Thanks Adrian. I've tried called: ie.modalDialog(), but I still can't
> > > > get the modalDialog object. In my case, a modalDialog window popup
> > > > from ie, i  can get the modalDialog object by calling ie.modalDialog
> > > > (), but if there is another modalDialog popuped from the modalDialog
> > > > window, the mothod ie.modalDialog desn't work. :-(
>
> > > > Adrian Ghidu wrote:
> > > > > Same method should be called: ie.modalDialog().
>
> > > > > On Fri, Dec 4, 2009 at 10:07 AM, Kevin <kevin.feng.g...@gmail.com>
> > > > wrote:
>
> > > > > > If there is a ModalDialog from an IE windows, i can use ModalDialog
> > > > > > modalDialog = ie.modalDialog() to get modalDialog object, and then
> > use
> > > > > > modalDialog handler to operate. How can i do if there are another
> > > > > > ModalDialog which will popup from a ModalDialog?
>
> > > > > > --
>
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "watij" group.
> > > > > > To post to this group, send email to wa...@googlegroups.com.
> > > > > > To unsubscribe from this group, send email to
> > > > > > watij+un...@googlegroups.com<watij%2Bunsu...@googlegroups.com>
> > <watij%2Bunsu...@googlegroups.com<watij%252Buns...@googlegroups.co­m>
> > ><
> > > > watij%2Bunsu...@googlegroups.com<watij%252Buns...@googlegroups.com­>
> > <watij%252Buns...@googlegroups.com<watij%25252Bunsubscribe@googlegroup­s.com>
>
> > > > >.
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/watij?hl=en.
>
> > > > --
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "watij" group.
> > > > To post to this group, send email to wa...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > watij+un...@googlegroups.com<watij%2Bunsu...@googlegroups.com><
> > watij%2Bunsu...@googlegroups.com<watij%252Buns...@googlegroups.com­>
> > >.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/watij?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "watij" group.
> > To post to this group, send email to wa...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > watij+un...@googlegroups.com <watij%2Bunsu...@googlegroups.com>.
> > For more options, visit this group at
> >http://groups.google.com/group/watij?hl=en.- Hide quoted text -
>
> - Show quoted text -

Adrian Ghidu

unread,
Dec 17, 2009, 4:53:54 PM12/17/09
to wa...@googlegroups.com
Hi Kevin,
Did you managed to solve your problem? If not, just to be sure, look at the javascript of the page and check that the call is window.showModalDialog and not window.showModelessDialog.
If it's the first, then you should implement a method that continues to call the ie.modalDialog() in case the modal dialog received is identical to the previous.

Regards
Adrian

To unsubscribe from this group, send email to watij+un...@googlegroups.com.

Adrian Ghidu

unread,
Feb 8, 2010, 12:19:33 PM2/8/10
to wa...@googlegroups.com
Hi Kevin,
If you didn't find a solution to your problem, I have one for you. Once you have clicked on an element inside the ie object it will be set "busy" until the method click returns - it doesn't matter if you're calling from a separate thread. That being said, it's strange that you can read the first modal dialog.
My solution is this: add a timeout for waituntilready call inside the modalDialog method and if you are opening a modal dialog from another you don't need to wait for the ie. I did some tests and is working for me.

Regards,
Adrian
Reply all
Reply to author
Forward
0 new messages