Re: Issue 284 in selenium: Support for window.showModalDialog

468 views
Skip to first unread message

sele...@googlecode.com

unread,
Jan 14, 2011, 7:44:03 PM1/14/11
to selenium-deve...@googlegroups.com

Comment #8 on issue 284 by swimmins...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

A workaround for Firefox that we've been using successfully is to use
Webdriver to focus (sendKeys("");) on a particular element and then use
Java's Robot class to simulate the pressing of the spacebar to perform the
action. This allows the modal dialog to open without blocking WebDriver
which can then detect the window and switch to it appropriately.

The problem in IE that we're experiencing is that webdriver doesn't even
recognize the popup window as a new IE window. It simply says that only 1
window exists whenever a modal popup appears. After looking (briefly) at
the IEThreadElement.cpp file, I noticed that the window class for a modal
window within IE8 (I haven't tried with IE6/7 yet) doesn't contain the
class that is used for modal popups ("Internet Explorer_TridentDlgFrame").
I'm wondering if this is part of the reason while the show_modal_dialog
functionality doesn't work in IE.

I can't verify if this would work since I don't have access to VS2008 or
greater to build the dll myself.

Hope this helps,
--Andy

sele...@googlecode.com

unread,
Jan 15, 2011, 8:23:57 AM1/15/11
to selenium-deve...@googlegroups.com

Comment #9 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

As of 2.0b1, the IE driver C++ code has been completely rewritten. The
method by which windows are enumerated has completely changed. There is a
TODO comment in the code where handling for showModalDialog windows in IE
should go.

sele...@googlecode.com

unread,
Jan 19, 2011, 12:15:22 PM1/19/11
to selenium-deve...@googlegroups.com

Comment #10 on issue 284 by leo.tumw...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

A workaround that I used successful on my own project is by forking a new
process to do the action that blocks the normal flow of watir-webdriver or
selenium (i.e. clicking on the link that opens the modal dialog).

This way, the main process and the browser instance remains free to do
window switching and other actions.

This might seem a bit costly, as we ARE starting another process, but it
doesn't depend on yet another library (Java Robot, Sikuli, etc) nor does it
require overriding any code of the website you are testing (i.e. changing
window.showModalDialog to window.open).

-Leo

sele...@googlecode.com

unread,
Jan 20, 2011, 7:47:13 PM1/20/11
to selenium-deve...@googlegroups.com
Updates:
Labels: -Type-Defect Type-Enhancement Browser-Firefox

Comment #11 on issue 284 by dhar...@google.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

(No comment was entered for this change.)

sele...@googlecode.com

unread,
Jan 21, 2011, 5:28:49 AM1/21/11
to selenium-deve...@googlegroups.com

Comment #12 on issue 284 by Zaixia.Z...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hi, Leo, Can you describe your workaround in detail? How did you forking a
new process with selenium? Thanks.

Andy, which version of selenium you are using? 2.0?

I am desparated for a solution to handle modal dialog issue on firefox or
IE 6....

sele...@googlecode.com

unread,
Jan 21, 2011, 3:40:36 PM1/21/11
to selenium-deve...@googlegroups.com

Comment #13 on issue 284 by swimmins...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I was using 2.0b1 and was looking at the trunk code here on the site when I
made my previous post. I'm assuming the public browsable source located
here on the code.google site IS the rewritten IE driver.

Not sure why this is being classified as a Firefox only "enhancement"?

Did I miss something? Are others not seeing the same behavior when using
2.0b1 with IE?

sele...@googlecode.com

unread,
Jan 22, 2011, 12:41:11 PM1/22/11
to selenium-deve...@googlegroups.com

Comment #14 on issue 284 by leo.tumw...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hi Zaixiz,

First off, let me clarify that I code in Ruby and I use Watir-Webdriver
which in turn uses Selenium-Webdriver to automate browsers. So, you'll
have to translate any details I give to their equivalent in pure Selenium
and the language of your preference.

The problem with opening a modal popup is that the current process gets
blocked waiting on the parent window. However, the browser instance from
Selenium itself is not blocked. I've found that you can still work with
the browser instance if somehow your process can continue to new lines of
code.

So, my workaround is to start a new process, which activates the modal
popup. The new process becomes the escape goat that gets blocked. This
leaves my original process free to continue onto code that does the window
switching and closing of the modal popup.

In Ruby, you can clone a current process with the "fork" method. From my
limited understanding, Java does not do "fork" very well (please correct me
if I am wrong and this is assuming you are using Java). However, you might
try starting a new thread in Java instead of a new process.

Anyway, this is how the Ruby code would look like:

browser = Watir::Browser.new(:firefox)

pid = fork {
browser.button(:id, "some-value").click //clicking on the button that
activates the modal popup
// This process gets blocked until the parent window gets back its
control from the modal popup
}

// The current process continues onto the code below
// You might have to tell Selenium to wait for the modal popup to appear
somehow
// Then proceed to switch to the modal popup
browser.driver.switch_to.window(browser.driver.window_handles.last)
//assuming the last window is the popup
browser.button(:id, "some-value").click //Do something in the popup or
click on the close button or whatever else you want to do
browser.driver.switch_to.window(browser.driver.window_handles.first)
//assuming the first window is the original parent window you want to
continue you work on.

Obviously, you'll have to fill in the blank and possible be more rigorous
in selecting the window to use...but that's basically how you would do
this. As mentioned earlier, you might want to try starting a new Thread as
oppose to a new process if you are using Java. I had to use fork to start
a new process in Ruby, because threads are not really full-blown threads in
Ruby.

Hope this helps,

Leo


sele...@googlecode.com

unread,
Jan 22, 2011, 1:35:48 PM1/22/11
to selenium-deve...@googlegroups.com

Comment #15 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Regarding IEThreadElement.cpp: Yes, the code posted here contains the
rewritten IE driver; however, the old replaced code is still in the
repository too. We (read: I) haven't deleted it yet. The old code is in the
InternetExplorerDriver directory under the cpp folder. The new code
replacing it is under the IEDriver directory. IEThreadElement.cpp is in the
former directory, and thus should be disregarded in looking at the source
code to understand the IE driver's behaviour. Under the latter directory,
there is a TODO comment in BrowserManager.cpp (at line 244, as of this
writing) that reads:

// TODO: Enumerate windows looking for browser windows
// created by showModalDialog().

sele...@googlecode.com

unread,
Jan 28, 2011, 11:36:30 AM1/28/11
to selenium-deve...@googlegroups.com

Comment #16 on issue 284 by sridurga...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284


Any one out there able to implement the solution suggested by Leo with IE
webdriver 2.0b1 version using java bindings??

When I was trying to do that HttpClient was throwing an error with
SingleConnection manager, which actually makes sense as client didnt get
control back from the previous request and when we span a child thread and
try to send one more request to the window it throws an error about
connection.
Am I missing some thing??

sele...@googlecode.com

unread,
Feb 1, 2011, 5:44:33 AM2/1/11
to selenium-deve...@googlegroups.com

Comment #17 on issue 284 by d2.lebe...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Did anybody try to use Watin+Selenium?
in my case, Watin does not open modal dialogs too.

In case when I am using patched Selenium (described some posts higher), and
executing this code:

var dialog = IE.AttachToIE(Find.ByUrl(url));
dialog.Element(Find.ByText("Add")).Click();
HtmlDialog regarding = dialog.HtmlDialog(Find.ByTitle("Look Up
Records"), 10);

watin cannot find displayed modal dialog.

sele...@googlecode.com

unread,
Apr 5, 2011, 3:13:07 AM4/5/11
to selenium-deve...@googlegroups.com

Comment #18 on issue 284 by paul.pi...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Just for those of you wanting to help out, BrowserManager.cpp referenced
above has been renamed Session.cpp. The comment for modal dialog support is
still there at line 282.
Trying hard...but cpp's not my cup of tea really :'(


sele...@googlecode.com

unread,
Apr 15, 2011, 11:08:23 AM4/15/11
to selenium-deve...@googlegroups.com

Comment #19 on issue 284 by paul.pi...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

James Evans has posted a changelist that aims at solving this issue for the
IE driver.
Look for r11989 and recompile the driver for testing! Thanks James!


sele...@googlecode.com

unread,
Apr 15, 2011, 4:29:09 PM4/15/11
to selenium-deve...@googlegroups.com

Comment #20 on issue 284 by paul.pi...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

James Evans has posted a changelist that aims at solving this issue for the
IE driver.

Look for r11989 for the recompiled libraries! Thanks James!

sele...@googlecode.com

unread,
May 31, 2011, 4:29:27 PM5/31/11
to selenium-deve...@googlegroups.com

Comment #21 on issue 284 by robert.e...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I tried to use the new driver dll that James posted, but now IE won't start
in WebDriver, any thoughts?

sele...@googlecode.com

unread,
Jun 1, 2011, 7:53:44 AM6/1/11
to selenium-deve...@googlegroups.com

Comment #22 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

What do you mean by "IE doesn't start"? Do you receive any error messages?
What does your test code look like?

sele...@googlecode.com

unread,
Jun 1, 2011, 11:02:30 AM6/1/11
to selenium-deve...@googlegroups.com

Comment #23 on issue 284 by robert.e...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I'm using the python driver, and I replaced the old IEDriver.dll with the
new, I tried to run the unit test and it just sits on import of modules,
and IE is never launched to executed the unit test. I'm a noob to the
webdriver side of selenium so I don't know how to enable the logging
object, if you could point in the right direct for python I'd be happy to
provide that

sele...@googlecode.com

unread,
Jun 1, 2011, 6:46:13 PM6/1/11
to selenium-deve...@googlegroups.com

Comment #24 on issue 284 by robert.e...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

It would open. I was using the dll that I pulled directly from a
subversion checkout, i tried the one attached to this ticket and all works
well. Not quite sure why the one from the checkout wouldn't open IE, any
idea?

sele...@googlecode.com

unread,
Jul 15, 2011, 2:14:22 PM7/15/11
to selenium-deve...@googlegroups.com

Comment #25 on issue 284 by swimmins...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Has anyone come across with Internet Explorer that their modal windows
(created via show_modal_dialog) are not recognized with Selenium 2.0.0?
See my earlier comment #8 for the specific problem I'm having with IE.

WebDriver doesn't seem to recognize the modals as windows at all. The call
to getWindowHandles() always returns 1 (for the window that generated the
modal).

sele...@googlecode.com

unread,
Jul 15, 2011, 4:32:25 PM7/15/11
to selenium-deve...@googlegroups.com

Comment #26 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Comment 9 indicates that the IE driver has been completely rewritten since
you posted your comment (IEThreadElement.cpp is no longer even in the
project!). Are you still experiencing problems with the latest release?
There *is* a known race condition in the handling of showModalDialog()
popup windows in IE, but it shouldn't be all that often that you would see
that. A pointer to a public page where the problem can be reproduced would
help immensely.

sele...@googlecode.com

unread,
Jul 19, 2011, 3:12:45 PM7/19/11
to selenium-deve...@googlegroups.com

Comment #27 on issue 284 by swimmins...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Thanks James.

You're right. It seems to be working for me now. Turns out that the
problem was that the action that generates the modal (losing focus or
clicking a button on the page) needs to be performed by WebDriver in order
for WebDriver to see the new window. My framework used Keyboard commands
to trigger the modal (due to a WebDriver FF bug) and so when run from IE I
wasn't able to get access to the modal at runtime.

I am however running into a new issue with iframes on those modal windows.
I can't seem to switchTo() my iFrame the same way I do for the non-modal
windows. The switchTo() statement doesn't throw an exception, but the
following find method can't find the element within the iframe because the
WebDriver context hasn't been successfully changed to the iframe. Any
thoughts? Or should I create a new bug for it.

sele...@googlecode.com

unread,
Jul 26, 2011, 11:19:02 AM7/26/11
to selenium-deve...@googlegroups.com

Comment #28 on issue 284 by james.to...@echelon.org: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I have a button that opens a new window with window.showModalDialog().
When I click it with InternetExplorerDriver (with IE8 and selenium 2.1.0),
it doesn't always show up in WindowHandles. Sometimes it does, sometimes
it doesn't -- I haven't found any consistency here. Might this be due to
the race condition James mentioned in comment 26?

Note that WindowHandles are always updated when window.open() is used.

Thanks!

sele...@googlecode.com

unread,
Jul 26, 2011, 11:23:04 AM7/26/11
to selenium-deve...@googlegroups.com

Comment #29 on issue 284 by tch...@gmail.com: Support for

sele...@googlecode.com

unread,
Jul 28, 2011, 12:18:13 PM7/28/11
to selenium-deve...@googlegroups.com

Comment #30 on issue 284 by tch...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

NOTE for comment 29:

I'm not sure if it makes a difference, but I'm using
window.showModalDialog() in a particular fashion to display a custom modal
dialog. The JavaScript is as follows:

var returnObjectModifiedByModalDialog = new Object();

var returnAction = window.showModalDialog("url in here" +
someStringAppendedToUrl,returnObjectModifiedByModalDialog,"window
attributes in here");

sele...@googlecode.com

unread,
Aug 31, 2011, 4:12:48 PM8/31/11
to selenium-deve...@googlegroups.com

Comment #31 on issue 284 by david.bu...@theautomatedtester.co.uk: Support
for window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Issue 1839 has been merged into this issue.

sele...@googlecode.com

unread,
Sep 22, 2011, 5:18:34 AM9/22/11
to selenium-deve...@googlegroups.com

Comment #32 on issue 284 by ratakond...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hi,

I too have a similar issue with model popups in our project.I am using
selenium2.0. I have a button in my application, clicking on this button
opens a model window. when i execute the selenium script in firefox, the
script gets hanged on button click even though the model window is opening
i am unable to select it using its title by "selenium.selectwindow()"
command.

I have made the necessary changes in selenium server.jar as mention in the
Amit's blog but i am out of ideas to handle the issue.

When i run the script in debug mode the cursor get stuck at the button
click and it is not coming to the next step where i have specified command
to select the window.

Code looks like this
------------------------
selenium.click("//input[@value='Associate']");-->getting stuck here

selenium.focus("title=Fieldglass: Associate Sites to Master Document");
selenium.selectWindow("title=Fieldglass: Associate Sites to Master
Document");

from the selenium IDE script the window name is

selenium.selectWindow("name=modalWindow1234");---> the model window name
changes dynamically . for example next time when i click for modelwindow it
could be "name=modalWindow5432".
So i have tried to use as selenium.selectWindow("name=modalWindow*").But
since the script is getting stuck at the previous step itself i am unable
to check if it works.

FYI
-----

When i click on Associate button which shows the modelwindow using selenium
IDE i could see two command getting executed.
step-1
selenium.open("/ master_list.do?sgjy=u6aeu1po2qamanj6q0b5f0ul6e9g7mvy");
step-2
selenium.click("//input[@value='Associate']");


but the model pop window is not "master_site_list" and "master_list" is a
parent window.

Could some one help me how to handle this issue.

And also help me how to use the modified selenium-server.jar in my script.

Thanks,
Rajesh


sele...@googlecode.com

unread,
Sep 22, 2011, 10:30:23 PM9/22/11
to selenium-deve...@googlegroups.com

Comment #33 on issue 284 by ratakond...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hi,

I too have a similar issue with model popups in our project.I am using
selenium2.0. I have a button in my application, clicking on this button
opens a model window. when i execute the selenium script in firefox, the
script gets hanged on button click even though the model window is opening
i am unable to select it using its title by "selenium.selectwindow()"
command.

I have made the necessary changes in selenium server.jar as mention in the
Amit's blog but i am out of ideas to handle the issue.

When i run the script in debug mode the cursor get stuck at the button
click and it is not coming to the next step where i have specified command
to select the window.

Code looks like this
------------------------
selenium.click("//input[@value='Associate']");-->getting stuck here

selenium.focus("title=XYZ: Associate Sites to Master Document");
selenium.selectWindow("title=XYZ: Associate Sites to Master Document");

sele...@googlecode.com

unread,
Sep 28, 2011, 10:11:12 AM9/28/11
to selenium-deve...@googlegroups.com

Comment #34 on issue 284 by ratakond...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

HI All, Can any one have a solution for my post on Sep22.Its an priority
requirement in implementing selenium on our project as i am stuck in
modalwindow.

Regards,
Rajesh.

sele...@googlecode.com

unread,
Sep 28, 2011, 10:23:21 AM9/28/11
to selenium-deve...@googlegroups.com

Comment #35 on issue 284 by nick.van...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Rajesh, I'm not totally up to date with this thread. But I also had the
problem when clicking the modal dialog. A fix for me is to use Webdriver to
focus (sendKeys("");) on a particular element and then use Java's Robot
class to simulate the pressing of the spacebar to perform the action. This
allows the modal dialog to open without blocking WebDriver which can then
detect the window and switch to it appropriately.(this is described in
comment #8).

The workaround is not bulletproof because it simulates pressing the
spacebar on the element that has the focus. But if you are just browsing
the internet while running the test(s) and the java robot class presses
spacebar when the focus is on something else, your test will fail.

sele...@googlecode.com

unread,
Oct 4, 2011, 1:52:16 PM10/4/11
to selenium-deve...@googlegroups.com

Comment #36 on issue 284 by dinesh...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hi All,
I am trying to test automate of a webpage which opens a modal dialog with
iframe. I use webdriver (selenium-server-standalone-2.7.0.jar). When i try
to find an element using xpath on the modal dialog, but i am not able to
find it. I even tried to get a window handle on the modal dialog box but
was unsuccessful. This issue is very critical to my project. Is this issue
planned to be solved for next release of webdriver?

-Dinesh

sele...@googlecode.com

unread,
Oct 4, 2011, 2:05:56 PM10/4/11
to selenium-deve...@googlegroups.com

Comment #37 on issue 284 by tch...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I believe this is somewhat related to issue 1828 where you can find some
possible work-arounds:
https://code.google.com/p/selenium/issues/detail?id=1828#c19

sele...@googlecode.com

unread,
Oct 12, 2011, 2:46:54 PM10/12/11
to selenium-deve...@googlegroups.com
Updates:
Labels: -Browser-Firefox Component-WebDriver

Comment #38 on issue 284 by barancev: Support for window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

(No comment was entered for this change.)

sele...@googlecode.com

unread,
Nov 29, 2011, 8:38:41 AM11/29/11
to selenium-deve...@googlegroups.com

Comment #39 on issue 284 by krishnan...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I have had the same problem as well and am running on Windows 7, IE 8 and
Selenium 2.12.0.

Please take a look at the following gist URL which basically has the html
pages required to simulate the problem, a sample java code which can be
used to simulate the problem and also the error.

Was wondering if someone can please help take a look at this issue ?

Gist URL : https://gist.github.com/1404611

sele...@googlecode.com

unread,
Dec 20, 2011, 4:14:56 AM12/20/11
to selenium-deve...@googlegroups.com

Comment #40 on issue 284 by adw...@hotmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I am using Robot Framework + Selenium2Library + Selenium/WebDriver 2.8.1 +
IE8 + Win 7, it seems that WebDriver already can handle doShowModalDialog
nicely. What you need to do is only to use Select Window keyword to switch
between modal and main window, although you may need to Select Window
multiple times, first few times may fail

sele...@googlecode.com

unread,
Dec 20, 2011, 11:31:17 AM12/20/11
to selenium-deve...@googlegroups.com

Comment #41 on issue 284 by christop...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

"As for issue 284, that issue simple asks for adding support for
showModalDialog() windows. This has been done for IE. I do not know about
other browsers."

If this is the case, then I can not seem to figure out what I am doing
wrong w/ my c#.NET code.
In my test, I have to click on a button in IE8( "search") which has an
onclick = "return openSearchDialog();"

openSearchDialog(); then fires a showModalDialog(); within, which loads a
modal with an iframe within it.
no matter what i do, I cannot seem to focus within the modal or iframe.

sele...@googlecode.com

unread,
Dec 20, 2011, 11:35:19 AM12/20/11
to selenium-deve...@googlegroups.com

Comment #42 on issue 284 by christop...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

"As for issue 284, that issue simple asks for adding support for
showModalDialog() windows. This has been done for IE. I do not know about
other browsers."

If this is the case, then I can not seem to figure out what I am doing

wrong.


In my test, I have to click on a button in IE8( "search") which has an
onclick = "return openSearchDialog();"

openSearchDialog(); then fires a showModalDialog(); within, which loads a
modal with an iframe within it.
no matter what i do, I cannot seem to focus within the modal or iframe.

Can anybody lend ANY advice on how to get past this issue?

sele...@googlecode.com

unread,
Dec 20, 2011, 2:15:33 PM12/20/11
to selenium-deve...@googlegroups.com

Comment #43 on issue 284 by rafael...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Does anybody fixed this issue in Selenium IDE for Firefox 8?

sele...@googlecode.com

unread,
Dec 20, 2011, 2:42:59 PM12/20/11
to selenium-deve...@googlegroups.com

Comment #44 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@christopher.baker1988 The base case is working for simple
showModalDialog() windows on IE. It may be possible that showModalDialog()
windows that contain iframes is not. If you want to open a new issue to
track that particular case (showModalDialog() windows with iframes not
working in IE), it can be worked on in due course, provided you supply a
reproducible test case (including a set of HTML files to test against).
Without the repro case, however, it's unlikely we'll be able to correctly
solve the problem to your satisfaction.

sele...@googlecode.com

unread,
Dec 21, 2011, 12:27:21 AM12/21/11
to selenium-deve...@googlegroups.com

Comment #45 on issue 284 by AndrewKo...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

catch same problem :( , I tried to update to 2.15 but it doesn't help, some
additional info:
FF and Chrome stuck in click call.
IE move on, but list of window handlers same as before click call.
Any ideas?

sele...@googlecode.com

unread,
Dec 21, 2011, 12:20:39 PM12/21/11
to selenium-deve...@googlegroups.com

Comment #46 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

The IE driver should now handle showModalDialog() windows with frames or
iframes as of r15250. This change will also be included when 2.16.0 is
released. If it doesn't solve your issue with showModalDialog() windows
with frames or iframes, do not report that failure as a comment in this
issue; instead, please open a new issue with a repro case.

sele...@googlecode.com

unread,
Dec 27, 2011, 2:00:15 PM12/27/11
to selenium-deve...@googlegroups.com

Comment #47 on issue 284 by christop...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@james That's great news! Any idea when that release is going to take place?

sele...@googlecode.com

unread,
Dec 28, 2011, 7:13:19 PM12/28/11
to selenium-deve...@googlegroups.com

Comment #48 on issue 284 by adw...@hotmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I also noticed FF get stucked in my showModalDialog test case, I am using
2.8

sele...@googlecode.com

unread,
Jan 5, 2012, 5:21:28 AM1/5/12
to selenium-deve...@googlegroups.com

Comment #49 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Just downloaded 2.16.0, no information about this bug fix in the release
notes.
Just tried one scenario, It says "No window found".

@James - Is this issue fixed in 2.16.0?

sele...@googlecode.com

unread,
Jan 5, 2012, 6:19:05 AM1/5/12
to selenium-deve...@googlegroups.com

Comment #50 on issue 284 by krishnan...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

The bug status still reads "New" so I dont think this is fixed yet !

sele...@googlecode.com

unread,
Jan 5, 2012, 7:00:28 AM1/5/12
to selenium-deve...@googlegroups.com

Comment #51 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

This issue is incredibly broad. It doesn't specify that it should be
implemented only in IE, so it can't be set to "Fixed". If we believe we've
fully implemented it for IE, and close the issue, surely someone would
complain that it's not implemented in Firefox or Chrome.

Yes, I can say definitively that you should now be able to use
showModalDialog() windows with IE; indeed, many people are already
successfully doing so. I can also confirm that the fix for problems people
were having accessing elements in frames/iframes in showModalDialog()
windows is included in 2.16.

sele...@googlecode.com

unread,
Jan 6, 2012, 6:13:45 AM1/6/12
to selenium-deve...@googlegroups.com

Comment #52 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@James - Thank you for the update (Fixed on IE).
I have tested on IE with 2.16, still Webdriver not able to identify the
model pop-up.

In my application model popup is invoked in the following way(.Net):
var val = window.showModalDialog(url + '?Ids=' + Id, null, 'dialogHeight:
600px; dialogWidth: 850px,dialogTop: 190px; dialogLeft: 120px; edge:
Raised; center: Yes;help: No; resizable: No; status: No;');

I have used following code to find all the window handles, Size is always
1. Following is the Webdriver code

driver.findElement(By.id("ctl00_CphePurchase_lnkCategory")).click();
Wait(10000); //Wait to load model pop-up
Set<String> availableWindows = driver.getWindowHandles();
Print("Handle Size: " +availableWindows.size());


sele...@googlecode.com

unread,
Jan 6, 2012, 10:14:55 AM1/6/12
to selenium-deve...@googlegroups.com

Comment #53 on issue 284 by arindam....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

The issue here is the thread that invokes the action "a click" which opens
a modal dialog gets stuck. I was able to get around this problem by
creating a new thread that would perform the "click" and then sacrifice it.
So the pseudo code is like this..
1. Select the button to click (Main Thread)
2. Create and start a new thread (that has a handle to the button) and
click. This thread will block (and I will so call it sacrificial thread)
3. If required wait for the modal-popup to open and continue to process
other Selenium statements.
If anyone needs a code example feel free to touchbase.

sele...@googlecode.com

unread,
Jan 6, 2012, 2:54:42 PM1/6/12
to selenium-deve...@googlegroups.com

Comment #54 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@arindam
I have tested the model-popup as per your above comments, not successful.
Tested on IE - 2.16.1, below is my code, please correct me if I have not
understood your comments properly.

WebDriver driver1;
driver1 = driver;
driver1.findElement(By.id("alnkRequester")).click(); //Activate Model
popup


Wait(10000);//Wait to load model pop-up

driver.findElement(By.id("txtSearchtext")).sendKeys("Bharath");
//Model popup element

sele...@googlecode.com

unread,
Jan 10, 2012, 6:13:08 AM1/10/12
to selenium-deve...@googlegroups.com

Comment #55 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hello All,

Please let me know If any one successful in handling the Model-Dialog on IE
and 2.16.1 invoked by the following code(.Net application).

var val = window.showModalDialog(url + '?Ids=' + Id, null, 'dialogHeight:
600px; dialogWidth: 850px,dialogTop: 190px; dialogLeft: 120px; edge:
Raised; center: Yes;help: No; resizable: No; status: No;');

Regards,
Bharath

sele...@googlecode.com

unread,
Jan 10, 2012, 6:37:27 AM1/10/12
to selenium-deve...@googlegroups.com

Comment #56 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hello All,

I have gone through the Microsoft site to understand how model pop-up is
created. It says

When Windows Internet Explorer opens a window from a modal or modeless HTML
dialog box by using the showModalDialog method or by using the
showModelessDialog method, Internet Explorer uses Component Object Model
(COM) to create a new instance of the window. Typically, the window is
opened by using the first instance of an existing Internet Explorer
process. When Internet Explorer opens the window in a new process, all the
memory cookies are no longer available, including the session ID. This
process is different from the process that Internet Explorer uses to open a
new window by using the open method.

http://msdn.microsoft.com/en-us/library/ms536759(VS.85).aspx


Regards,
Bharath

sele...@googlecode.com

unread,
Jan 10, 2012, 1:37:55 PM1/10/12
to selenium-deve...@googlegroups.com

Comment #57 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hello All,

In the below link it is mentioned that there is a workaround using Ruby -
Fork (Cloning the current process), he also says that it is not possible in
Java.

http://code.google.com/u/114873496028287600096/updates

Did any one try in Java?

I am desperately trying to find a solution, major flow is getting blocked
in my application.

Regards,
Bharath.


sele...@googlecode.com

unread,
Jan 10, 2012, 1:41:58 PM1/10/12
to selenium-deve...@googlegroups.com

sele...@googlecode.com

unread,
Jan 11, 2012, 7:54:14 PM1/11/12
to selenium-deve...@googlegroups.com

Comment #59 on issue 284 by sk1...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I too am getting the same results as bharath when i try to print the window
handles.

I even tried clicking the button by sending a space on the element so that
the call does not get blocked but there is only one window handle printed.

This too is blocking me since all windows that open in my application are
modal windows.

sele...@googlecode.com

unread,
Jan 18, 2012, 6:29:55 AM1/18/12
to selenium-deve...@googlegroups.com

Comment #60 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I came across the following post on MSDN blog, this can provide an idea on
how to handle the dialog using COM.

http://blogs.msdn.com/b/sanket/archive/2007/09/28/understanding-window-handling-of-ie-modal-dialogs.aspx

Regards,
http://bharath-marrivada.blogspot.com

sele...@googlecode.com

unread,
Jan 18, 2012, 10:35:33 AM1/18/12
to selenium-deve...@googlegroups.com

Comment #61 on issue 284 by milan.ce...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I tested the modal window as part of migration to selenium 2 and firstly
was very happy that I got handle to modal window and can switch to modal
and fill fields and submit buttons on modal page. As I found later this
work only when I'm running test in debug mode in Eclipse. But why,I don't
know ? And I found that in my test which open 5times modal popup running in
debug rarely in some opening window hang (I didn't get the handle to
windows)

sele...@googlecode.com

unread,
Jan 18, 2012, 10:51:43 AM1/18/12
to selenium-deve...@googlegroups.com

Comment #62 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@barath.raj.reddy I'm still waiting a sample set of HTML pages that
reproduces the problem as described in comments 52, 54, and 56. Regarding
comment 60, if you examine the C++ code that defines the core of the IE
driver's functionality, you'll see that the methods described in the blog
post you reference are virtually identical to those we use in the driver.
This has been the case since showModalDialog() support was added to the IE
driver, with the only difference being that we use the EnumWindows() API
which is functionally equivalent to using the EnumChildWindows() API with
the desktop window handle as the parent.

sele...@googlecode.com

unread,
Jan 18, 2012, 4:38:39 PM1/18/12
to selenium-deve...@googlegroups.com

Comment #63 on issue 284 by sk1...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@james.

https://developer.mozilla.org/samples/domref/showModalDialog.html

should reproduce the problem for you to test.


sele...@googlecode.com

unread,
Jan 18, 2012, 4:42:45 PM1/18/12
to selenium-deve...@googlegroups.com

Comment #64 on issue 284 by sk1...@gmail.com: Support for

sele...@googlecode.com

unread,
Jan 19, 2012, 1:14:11 AM1/19/12
to selenium-deve...@googlegroups.com

Comment #65 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@James - I have sent HTML pages to your email.

sele...@googlecode.com

unread,
Jan 19, 2012, 9:21:44 AM1/19/12
to selenium-deve...@googlegroups.com

Comment #66 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@bharath I've received your email, and am able to successfully switch to
and manipulate the modal dialog.

sele...@googlecode.com

unread,
Jan 19, 2012, 9:33:50 AM1/19/12
to selenium-deve...@googlegroups.com

Comment #67 on issue 284 by sk1...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

James, can you post the code that Bharath sent you and your code that
interacted with the modal window.

( I believe Bharath is looking at a java based solution.)

Thanks
Shrikant

sele...@googlecode.com

unread,
Jan 19, 2012, 9:37:52 AM1/19/12
to selenium-deve...@googlegroups.com

Comment #68 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@sk1 - Java code sent by James for my Modal dialog, still I did't try this
on my application.

[Test]
public void ModalTest()
{
// Assume "driver" is a properly instantiated
InternetExplorerDriver instance.
driver.Url = "http://localhost/modal/modal.html";
IWebElement element =
driver.FindElement(By.Id("ctl00_CphePurchase_btnSelectVendor1"));
element.Click();

// Wait for the number of window handles to be greater than 1,
or a timeout.
DateTime timeoutEnd = DateTime.Now.Add(TimeSpan.FromSeconds(5));
while (driver.WindowHandles.Count == 1 && DateTime.Now <
timeoutEnd)
{
System.Threading.Thread.Sleep(100);
}

// Save the current window handle, and switch to the newly
opened one.
string currentHandle = driver.CurrentWindowHandle;
foreach (string handle in driver.WindowHandles)
{
if (handle != currentHandle)
{
driver.SwitchTo().Window(handle);
break;
}
}

// If we've gotten to this point without switching windows,
this will
// throw an exception. In my case, it does not, if I'm able to
ignore
// the JavaScript compiler errors.

driver.FindElement(By.Id("vmmComponent_txtBCompanyName")).SendKeys("Bharath");
driver.Close();
driver.SwitchTo().Window(currentHandle);

sele...@googlecode.com

unread,
Jan 19, 2012, 10:13:06 AM1/19/12
to selenium-deve...@googlegroups.com

Comment #69 on issue 284 by sk1...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

this is a c# code.

Anyways I had tried the same thing in java... with the exception of

while (driver.WindowHandles.Count == 1 && DateTime.Now < timeoutEnd)
{
System.Threading.Thread.Sleep(100);
}

I wonder if that did the trick.

Do you think using c# drivers instead of java could have made the
difference ?

Anyways, when you try ( and if you do that in Java) please post your code

if you could confirm if it works on
https://developer.mozilla.org/samples/domref/showModalDialog.html
it would be great.

Thanks,
Shrikant

sele...@googlecode.com

unread,
Jan 19, 2012, 3:23:06 PM1/19/12
to selenium-deve...@googlegroups.com

Comment #70 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@James - Thank you for solving this issue on IE (I have tested only on IE)

Java code for handling IE Modal dialog
http://msdn.microsoft.com/en-us/library/ms536759(VS.85).aspx

I hope following example will help you to solve the issue.

driver.findElement(By.id("ctl00_CphePurchase_lnkCategory")).click();
//Open Modal dialog
Wait(9000);
driver.getWindowHandles();


Set<String> availableWindows = driver.getWindowHandles();
Print("Handle Size:" +availableWindows.size());

int Windows = 2;
if (availableWindows.size()==Windows) {

// For loop for modal popup
for (String windowId : availableWindows) {
if ("Select Product &
Category".equals(driver.switchTo().window(windowId).getTitle())){
Print("Modal popup:"+driver.getTitle());

driver.findElement(By.id("chk_PASID_94135508")).click();
driver.findElement(By.id("btnDown")).click();
break; // Task completed, just come out
}
}

// For loop back to parent
for (String windowId : availableWindows) {
driver.switchTo().window(windowId);
if
(("Requisition".equals(driver.switchTo().window(windowId).getTitle()))){
Print("Parent Window:"+driver.getTitle());
break; // Task completed, just come out
}
}
}
else
{
Print("No popups found"); //Implement assertion
}

Thanks,
http://bharath-marrivada.blogspot.com

sele...@googlecode.com

unread,
Jan 19, 2012, 3:27:09 PM1/19/12
to selenium-deve...@googlegroups.com

Comment #71 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@James - Thank you for solving this issue on IE (I have tested only on IE)

I hope following example will help you to solve the issue.

driver.findElement(By.id("ctl00_CphePurchase_lnkCategory")).click();
//Open Modal dialog

Wait(9000); // Wait for popup. Need to optimize the code

sele...@googlecode.com

unread,
Jan 19, 2012, 3:33:14 PM1/19/12
to selenium-deve...@googlegroups.com

Comment #72 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@James - Thank you for solving this issue on IE (I have tested only on IE)

I hope following example will help you to solve the issue.

driver.findElement(By.id("ctl00_CphePurchase_lnkCategory")).click();
//Open Modal dialog
Wait(9000); // Wait for popup. Need to optimize the code

driver.getWindowHandles();


Set<String> availableWindows = driver.getWindowHandles();
Print("Handle Size:" +availableWindows.size());
int Windows = 2;
if (availableWindows.size()==Windows) {

// For loop for modal popup
for (String windowId : availableWindows) {
if ("Select Product &
Category".equals(driver.switchTo().window(windowId).getTitle())){
Print("Modal popup:"+driver.getTitle());

driver.findElement(By.id("chk_PASID_94135508")).click();
driver.findElement(By.id("btnDown")).click();
break; // Task completed, just come out
}
}

// For loop back to parent
for (String windowId : availableWindows) {

sele...@googlecode.com

unread,
Jan 19, 2012, 5:12:08 PM1/19/12
to selenium-deve...@googlegroups.com

Comment #73 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@sk176h Unless you're just looking for public proof that the feature works
in IE, I'm not sure what the fixation is with the developer.mozilla.org
site, as the feature has been tested successfully against other sites using
showModalDialog() windows. The .NET bindings have unit tests that
specifically test handling of showModalDialog() windows. Cases where the
handling them in IE doesn't work tend to be unique to the specific set of
pages, which is why I repeatedly ask for a reproducible case.

Nevertheless, I've posted a complete example using the .NET bindings, C#,
NUnit, and using the Mozilla.org site posted at
https://gist.github.com/1642921. Furthermore, to help those who are most
comfortable in Java, I've tried to annotate the example with comments
indicating what similar Java constructs would be.

sele...@googlecode.com

unread,
Jan 20, 2012, 1:25:00 AM1/20/12
to selenium-deve...@googlegroups.com

Comment #74 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@James - For IE & Java, I need to use following statements to get the all
window handles

driver.getWindowHandles();
Set<String> availableWindows = driver.getWindowHandles();

If I just use following statement, I get only one handle. This was reason
why I failed to get the modal dialog handle initially.

Set<String> availableWindows = driver.getWindowHandles();

Is it an issue with the Java bindings? Please clarify.

Thanks,
http://bharath-marrivada.blogspot.com

sele...@googlecode.com

unread,
Jan 20, 2012, 1:31:03 AM1/20/12
to selenium-deve...@googlegroups.com

Comment #75 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@James - For IE & Java, I need to use following statements to get the all
window handles

driver.getWindowHandles();
Set<String> availableWindows = driver.getWindowHandles();

Print("Handle Size:" +availableWindows.size());

If I just use following statement, I get only one handle. This was reason
why I failed to get the modal dialog handle initially.

Set<String> availableWindows = driver.getWindowHandles();

Print("Handle Size:" +availableWindows.size());

sele...@googlecode.com

unread,
Jan 20, 2012, 8:28:56 AM1/20/12
to selenium-deve...@googlegroups.com

Comment #76 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

It's most assuredly not the Java bindings. All of the language bindings
delegate to the same C++ code under the covers. For whatever reason, the
first time you call getWindowHandles(), the dialog hasn't had time for
WebDriver to register it. By the second time you call getWindowHandles(),
it is. I realize you're using a 9000 millisecond sleep to wait for the
dialog to appear, and as far as I'm aware, this should be enough; however,
it's not working in this case, and it's not good practice for something
like this anyway. It's possible the long sleep is preventing the correct
detection of the modal dialog after the click. Rather than a single large
sleep, you should be polling for changes at a small interval. You can see
this in the example posted here, and at github. You can code such a wait
yourself, as I've done here, or use the WebDriverWait class to accomplish
the same thing.

sele...@googlecode.com

unread,
Jan 20, 2012, 8:34:59 AM1/20/12
to selenium-deve...@googlegroups.com

Comment #77 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@james - Thanks for the update, I will implement polling for small interval
time.

sele...@googlecode.com

unread,
Jan 24, 2012, 6:41:40 AM1/24/12
to selenium-deve...@googlegroups.com

Comment #78 on issue 284 by shekar.k...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@Bharath Or Anyone , please help me on this issue -

I used the below code which was suggested by Bharat to get handle on the
pop up and access the elements on the popup window.

Using the below code , I could get the pop-up window title OR pop-up URL as
u could see the print statements.

But when i coded like -
driver.findElement(By.id("ins_id")).sendKeys("0.2");, it is not setting the
value in the respective text box in the pop-up!! ( I copied the small
snippet of DOM source at the end of this below code )

-------------------------------------------------------------------


driver.getWindowHandles();
Set<String> availableWindows = driver.getWindowHandles();

System.out.println("Handle Size:" +availableWindows.size());


int Windows = 2;
if (availableWindows.size()==Windows)
{

// For loop for modal popup
for (String windowId : availableWindows)
{

if ("pop up
title".equals(driver.switchTo().window(windowId).getTitle()))
{
System.out.println("Modal popup:"+driver.getTitle());



System.out.println( " driver.getCurrentUrl --> " +
driver.getCurrentUrl()); // this is fine...returning correctly
System.out.println( " driver.get title --> " +
driver.getTitle()); // this is fine

System.out.println( " driver.get wndw hndle
--> " + driver.getWindowHandle());


driver.findElement(By.id("ins_id")).sendKeys("0.2"); // not
working..."ins_id" is the id of the text field in the popup window

driver.findElement(By.xpath( "//input[@id='ins_id']")).sendKeys("0.1"); //
//not working
-------------------------------------------------------------------------------

DOM source :
--------------
<input name="ins_name"
title="ins_title"
class="NormalField" id="ins_id" style="width: 55px;"
type="text" maxLength="8"
LabelControl="ins_lbl" ClientName="ins_client"/>

This is .NET application. My OS is Windows 7 Professional. jar file :
selenium-server-standalone-2.17.0.jar
Any suggestions is greatly appreciated!

sele...@googlecode.com

unread,
Jan 24, 2012, 11:30:41 AM1/24/12
to selenium-deve...@googlegroups.com

Comment #79 on issue 284 by sk1...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Thanks James,

I think we were missing the polling logic. I used polling and it works like
a charm

Thanks,
Shrikant

sele...@googlecode.com

unread,
Jan 26, 2012, 11:41:36 AM1/26/12
to selenium-deve...@googlegroups.com

Comment #80 on issue 284 by testk...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I tried ti use the following example without success. In general when I'm
using the default method in IE webdriver doesn't see the window.
Here is my test -
@Test
public void verifySetCreation() throws InterruptedException {

loginPage.loginAsUser(login, password);
Thread.sleep(9000);
driver.switchTo().window("ModalWindowHack");
getPagesManager().getEditSetItemDialog().addClaim("auto", "bikes");
getPagesManager().getEditSetItemDialog().getOkButton().click();
}
The window is opened and full stop. (:
Window not found.
I need help.

sele...@googlecode.com

unread,
Jan 27, 2012, 5:41:52 AM1/27/12
to selenium-deve...@googlegroups.com

Comment #81 on issue 284 by testk...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I tried ti use the following example without success. In general when I'm
using the default method in IE webdriver doesn't see the window.
Here is my test -
@Test
public void verifySetCreation() throws InterruptedException {

loginPage.loginAsUser(login, password);
getPagesManager().getSetPage().getAddManuallyButton().click();
Thread.sleep(1000);

sele...@googlecode.com

unread,
Jan 27, 2012, 8:57:53 AM1/27/12
to selenium-deve...@googlegroups.com

Comment #82 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

A showModalDialog() window doesn't have a name, so switching to it by name
will not work. You will have to use the WebDriver window identifier
(or "handle"). Additionally, the use of a straight Thread.sleep() is not
likely to work either. You'll need to implement some polling logic either
using WebDriverWait, or something similar to (a Java version of) the code
posted at the github gist referenced above[1].

[1] https://gist.github.com/1642921

sele...@googlecode.com

unread,
Jan 28, 2012, 11:35:54 AM1/28/12
to selenium-deve...@googlegroups.com

Comment #83 on issue 284 by jragha...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I am facing a wired problem of selenium identify the elements under model
window as hidden. Even though the element is clearly available for the user
interaction. I am using Win XP,7 Selenium 2.17 IE 8,9


sele...@googlecode.com

unread,
Jan 29, 2012, 2:19:30 PM1/29/12
to selenium-deve...@googlegroups.com

Comment #84 on issue 284 by sk1...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I just upgraded to Selenium 2.18 and i am getting an

org.openqa.selenium.UnhandledAlertException

when i try to do getWindowHandles on the IE Driver object.

Has something changed between implementations

sele...@googlecode.com

unread,
Jan 30, 2012, 1:16:54 PM1/30/12
to selenium-develope...@googlegroups.com

Comment #85 on issue 284 by testk...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Thank all for the comments. The issue was fixed using "handles". After that
webdriver works with modal window's fields, but doesn't work with OK and
Cancel controls on the window. Please note that it worked fine before.
After installing 2.18 the fix failed and the window is invisible.
Any ideas?

sele...@googlecode.com

unread,
Jan 31, 2012, 9:11:06 AM1/31/12
to selenium-develope...@googlegroups.com

Comment #86 on issue 284 by adam.kim...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I am having the same problem as sk1. After upgrading to selenium 2.18 I
receive a

org.openqa.selenium.UnhandledAlertException: Modal dialog present

when I try to do getWindowHandles in IE. I cannot interact with anything on
the main window or the modal dialog. Previously I would switch to the modal
dialog and interact with it using

driver.switchTo().window(windowhandle);

It allows me to switch to modal using

driver.switchTo().alert()

but I cannot interact with the page like I previously was able to (update
input boxes, drop down menus, etc). Any ideas how to get around this now?

sele...@googlecode.com

unread,
Jan 31, 2012, 11:25:35 AM1/31/12
to selenium-develope...@googlegroups.com

Comment #87 on issue 284 by barancev: Support for window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

2.18 has been changed to deal with unhandled alerts [1].

It was discussed on the dev list [2] and agreed that all requests should be
blocked if a modal present, exept for the requests that deal with the
modal. Sounds like it is too strict -- window manipulation requests should
be excluded from this rule too. This will be fixed in 2.19.

[1] http://code.google.com/p/selenium/source/browse/trunk/java/CHANGELOG
[2] https://groups.google.com/forum/#!topic/selenium-developers/9_hK0O4Qpe8

sele...@googlecode.com

unread,
Jan 31, 2012, 12:29:11 PM1/31/12
to selenium-develope...@googlegroups.com

Comment #88 on issue 284 by hmano...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

It was the good idea to handle alerts but if modal dialog window popup
populate then driver.getWindowHandles(); throwing UnhandledAlertException

sele...@googlecode.com

unread,
Jan 31, 2012, 1:03:34 PM1/31/12
to selenium-develope...@googlegroups.com

Comment #89 on issue 284 by hmano...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I m facing problem on modal dialog window popup if alert present on it and
i use driver.switchto().alert().accept(); then webdriver throwing exception
ie; NoAlertPresentException


sele...@googlecode.com

unread,
Feb 1, 2012, 2:36:48 PM2/1/12
to selenium-develope...@googlegroups.com

Comment #90 on issue 284 by geromett...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

The app opens another window after entering in a link, if i attempt to
change the url then the destination page doesnt seem to get that there is a
logged user.

if i could switch the window back to the first one then i could easily
re-write the url as i did in firefox.

maybe there is a hack to this bug using win32gui?

sele...@googlecode.com

unread,
Feb 3, 2012, 5:49:47 PM2/3/12
to selenium-develope...@googlegroups.com

Comment #91 on issue 284 by n...@rj1.org: Support for window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I see that UnhandledAlertException shouldn't be triggered by a modal dialog
window as of r15807. Are there plans for a similar interface for unhandled
modal windows at this time?

sele...@googlecode.com

unread,
Feb 15, 2012, 11:41:39 AM2/15/12
to selenium-develope...@googlegroups.com

Comment #92 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

I am using 2.16 and my scripts are running fine.
Just downloaded 2.19 and ran the test, most of the tests failed with Modal
dialog present error.
When I move back to 2.16, the same scripts are working fine.

This error occurs for a approver button.

Client code for this button is

<input name="btnAppApprove" id="Button2" onclick="javascript:return
ApproveEntity(2,1)" type="button" value="Approve"/>


function ApproveEntity(approvalFlag, approvalType) {

_globalApprovalStatus = approvalFlag;
_globalApprovalType = approvalType;
var adhocApproverId =
document.getElementById(_varhdnAdhocApprover).value;

if (approvalFlag == 2)
_globalComments = '';
//document.getElementById('txtApprovedComments').innerText;
if (approvalFlag == 5) {
_globalComments =
document.getElementById('txtRejectComments').innerText;
if (adhocApproverId > 0) {
if (approvalFlag == 5) {
$find('ModalPopupExtenderBehaviorReject').hide();
document.getElementById(btnHiddenRejectPopup).click();
return false;
}
}
}
if (_globalComments.length <= 1024) {
SendForApprovalFlow();
}
else {
document.getElementById('spnRej').innerText = 'Comments length
should not exceed 1024 characters';
return false;
}

return false;
}


When I started digging the client code to understand why selenium is
detecting the Modal dialog, I have noticed developers have called
$find('ModalPopupExtenderBehaviorReject').hide(); to hide if modal dialog
present.

I feel changes made in the comment #87 is causing the issue.
http://code.google.com/p/selenium/issues/detail?id=284#c87

http://bharath-marrivada.blogspot.in

sele...@googlecode.com

unread,
Feb 17, 2012, 1:58:25 AM2/17/12
to selenium-develope...@googlegroups.com

Comment #93 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hello IE Driver Team,

Can you please look into comment 92, I am not able to upgrade to 2.19.

sele...@googlecode.com

unread,
Feb 22, 2012, 5:38:40 AM2/22/12
to selenium-develope...@googlegroups.com

Comment #94 on issue 284 by dimi...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

is there any way to deal with a page that displays an alert through the
JSON remote protocol?

When I try to get a URL of the page with an alert, I'm getting an exception:

11:14:11.332 WARN - Exception thrown
org.openqa.selenium.UnhandledAlertException: Modal dialog present

I'm using the Remote Webdriver 2.19

sele...@googlecode.com

unread,
Feb 24, 2012, 12:36:30 PM2/24/12
to selenium-develope...@googlegroups.com

Comment #95 on issue 284 by sumedh0...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Same Issue of "org.openqa.selenium.UnhandledAlertException: Modal dialog
present" is happened with me.


sele...@googlecode.com

unread,
Mar 2, 2012, 2:48:08 AM3/2/12
to selenium-develope...@googlegroups.com

Comment #96 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

IE driver 2.20 - Modal dialog present error for a Java-script alert.

sele...@googlecode.com

unread,
Mar 2, 2012, 10:14:31 AM3/2/12
to selenium-develope...@googlegroups.com

Comment #97 on issue 284 by james.h....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@bharath The UnhandledAlertException is exactly what you should see when
you do not handle a modal dialog produced by the JavaScript alert(),
confirm() or prompt() functions. These are completely separate from
handling of dialogs created by showModalDialog().

sele...@googlecode.com

unread,
Mar 5, 2012, 5:32:09 AM3/5/12
to selenium-develope...@googlegroups.com

Comment #98 on issue 284 by bharath....@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@Jim - Thank you,now I got it. I was checking for Page loader icon on the
page when alert was generated. My code is working fine on 2.20.

sele...@googlecode.com

unread,
Mar 26, 2012, 12:06:19 PM3/26/12
to selenium-develope...@googlegroups.com

Comment #99 on issue 284 by hmano...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@Jim..Any update on comment89.


sele...@googlecode.com

unread,
Mar 27, 2012, 3:36:07 AM3/27/12
to selenium-develope...@googlegroups.com

sele...@googlecode.com

unread,
Apr 12, 2012, 6:47:44 PM4/12/12
to selenium-develope...@googlegroups.com

Comment #101 on issue 284 by vik...@sociablelabs.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hi All,
I inherited a set of tests using WebDriver 2 Java API. We test a lot of
sites that are guarded by a login (javascript popup I believe). The login
dialog blocks WebDriver.get().
The solution I inherited was to spawn another thread where a Robot enters
logon credentials separated by TAB and submitted by ENTER.
This works wonderfully except that sometimes (especially during test
start) the Firefox window does not seem to have focus. The Robot proceeds
to type in whatever application has focus or switching between applications
if the desktop was empty at the start. Does anyone have ideas how I could
ensure that the Firefox window is activated? We have a Jenkins job that
performs mvn test to fire this off. Alternatively, I start tests through
IntelliJ IDE and the problem surfaces in both environments, requiring me to
click the Firefox window (not very automated).

Any help is greatly appreciated!

sele...@googlecode.com

unread,
Apr 12, 2012, 7:41:33 PM4/12/12
to selenium-develope...@googlegroups.com

Comment #102 on issue 284 by mariofdu...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@vik
have you tried to driver.switchTo().defaultContent() to get focus of the
firefox window?

sele...@googlecode.com

unread,
Apr 27, 2012, 6:20:23 AM4/27/12
to selenium-develope...@googlegroups.com

Comment #103 on issue 284 by kary.a...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Hi All,

I am using Ruby 1.9.2 , firefox 5.0.1 , selenium-webdriver-2.20.0 (before
upgrading to it both of the following cases worked fine) , win7 (sp1)

On one of my pages I have a confirmation box coming up (using confirm()
method of javascript) where it is handled.

But on another page I have the same alert with different text in it,
throwing the following error:-

["[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/command_processor.js:10583:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/driver_component.js:9631:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/driver_component.js:9785:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/driver_component.js:9732:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/driver_component.js:10781:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/httpd.js:1935:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/httpd.js:2261:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/httpd.js:1168:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/httpd.js:1616:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/httpd.js:1464:in
`unknown'", "[remote server]
file:///C:/Users/karishma/AppData/Local/Temp/webdriver-profile20120426-3328-1m5vt7s/extensions/fxdr...@googlecode.com/components/httpd.js:1333:in
`unknown'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/response.rb:52:in
`assert_ok'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/response.rb:15:in
`initialize'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/common.rb:59:in
`new'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/common.rb:59:in
`create_response'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/default.rb:64:in
`request'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/http/common.rb:40:in
`call'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/bridge.rb:594:in
`raw_execute'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/bridge.rb:572:in
`execute'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/remote/bridge.rb:540:in
`find_element_by'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.20.0/lib/selenium/webdriver/common/search_context.rb:42:in
`find_element'", "D:/mixer/Automation/EC RB
AUT/In-common/first_message.rb:19:in `msend'", "D:/mixer/Automation/EC RB
AUT/In-common/first_message.rb:82:in
`test_first_message'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/testcase.rb:562:in
`run_test'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/testcase.rb:326:in
`run'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/testsuite.rb:53:in
`run'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/testsuite.rb:53:in
`run'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/ui/testrunnermediator.rb:54:in
`run_suite'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/ui/testrunner.rb:40:in
`start_mediator'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/ui/testrunner.rb:25:in
`start'", "c:/Ruby192/lib/ruby/gems/1.9.1/gems/test-unit-2.4.8/lib/test/unit/ui/testrunnerutilities.rb:24:in
`run'"


The code that I have written in both the cases is :-

alert = @driver.switch_to.alert rescue
Selenium::WebDriver::Error::NoAlertOpenError

if (alert.text == "the text i want")
alert.accept()
else
alert.dismiss()
end

I do not seem to understand what could possibly be the reason for different
behavior when everything is same.

Please let me knw of anyone has any idea.

sele...@googlecode.com

unread,
Apr 30, 2012, 8:25:28 PM4/30/12
to selenium-develope...@googlegroups.com

Comment #104 on issue 284 by jari.bakken: Support for window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@kary.ajrj: This issue is about showModalDialog, not confirm() dialogs.
Please open a separate issue for your problem (and make sure to include the
full error *message*, not just the backtrace).

sele...@googlecode.com

unread,
May 2, 2012, 1:28:37 AM5/2/12
to selenium-develope...@googlegroups.com

Comment #105 on issue 284 by kary.a...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

@jari.bakken: Thank you for directing me.

I have logged a new issue for this

http://code.google.com/p/selenium/issues/detail?id=3839&thanks=3839&ts=1335936323

and included the complete error message.

sele...@googlecode.com

unread,
May 19, 2012, 4:49:08 PM5/19/12
to selenium-develope...@googlegroups.com

Comment #106 on issue 284 by barancev: Support for window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

Issue 3615 has been merged into this issue.

sele...@googlecode.com

unread,
May 25, 2012, 10:58:14 AM5/25/12
to selenium-develope...@googlegroups.com

Comment #107 on issue 284 by hmano...@gmail.com: Support for
window.showModalDialog
http://code.google.com/p/selenium/issues/detail?id=284

In my modal dialog popup window there are some mandatory fields when i
clicked submit button to verify mandatory fields then java script
alerts take place but i m not able to verify such alerts using the
selenium.isalertpresent() or driver.switchto().alert() and console print
noalertpresent exception.

It is loading more messages.
0 new messages