selectWindow doesn't recognize new window

894 views
Skip to first unread message

Friendkey

unread,
Mar 7, 2010, 9:58:14 PM3/7/10
to Selenium Users
Hi,

Selenium doesn't recognize my new window.
The new window is created by submit a form with target="uploadWindow".
All I know is use "selectWindow" to operate on the new window.
The script recorded by selenium IDE:

click link=Upload CSV
selectWindow name=uploadWindow

But it says cannot find the window when replay the script.

I tried selenium RC, and the result is the same.
And then I tried to use "all_window_names" in selenium-RC to see
whether the name is right, but the new window is not listed.

Above is done on Firefox.

Any idea or workaround?

SiKing

unread,
Mar 8, 2010, 12:29:39 PM3/8/10
to Selenium Users
Not all windows are named. Try all_window_ids and all_window_titles
and see if either of those help you.

HTH.

sridhar

unread,
Mar 8, 2010, 9:47:52 PM3/8/10
to Selenium Users
Hi buddy,

This is a very good blog about handling popup message. Go through it.
You should be able to solve your problem. If not then let me know.

http://qtp-help.blogspot.com/2009/07/selenium-handling-windows.html#comment-form

Ritesh

unread,
Mar 10, 2010, 2:54:00 AM3/10/10
to Selenium Users
Hi,

You need to focus the new window, first try to find out name of new
window using selenium IDE (for this just record anything from new
window) then use bellow code

selenium.click(locator);
selenium.selectWindow("window name");
selenium.windowFocus();

Thanks
Ritesh

Friendkey

unread,
Mar 11, 2010, 12:27:10 AM3/11/10
to Selenium Users
Thank you all. I worked it out!
The window name is right, it's selenium's fault. It seems that
selenium doesn't know the window opened by my web page. It can only
recognize window opened by itself.
So the workaround is:
1. open a window by selenium with the same name as the target new
window, for example: selenium.openWindow('', 'My Window')
2. click button (by selenium) to open the new window, for example:
selenium.click(locator)
comment: the window name is "My Window" (same as previous).
Firefox won't open a new window, but use the window opened by last
step
3. now, selectWindow is able to recognize "My Window"

Hopes it helps people encounters the similar problem.

rama

unread,
Mar 11, 2010, 9:22:29 AM3/11/10
to Selenium Users
Hi

Does this solution works for pop-up windows? In HTTPs a security
warning pop-window is opening and is not recognised by selenium IDE.
I tried the solution given but still not working.

pop-up security warning contains with two buttons Continue and Cancel:
" Although this page is encrypted, the information you have entered is
to be sent over an unencrypted connection and could easily be read by
a third party.
Are you sure you want to continue sending this information?"

Could you please help me on what am i doing wrong. I tried like this

selenium.openWindow("", "Security Warning");
selenium.selectWindow("Security Warning");
selenium.click("Continue");


Thanks in advance
Rama

> > > Any idea or workaround?- Hide quoted text -
>
> - Show quoted text -

Pooja

unread,
Mar 11, 2010, 7:39:21 AM3/11/10
to Selenium Users
Hi FriendKey,

do we need to specify the window id in selenium.openWindow() or can i
use window title also?
bcoz your solution is not working for me.
i click a button on the parent window and it opens a new window which
does not have windowid but have a title only.
please tell what can be the solution in this case. and moreover i was
not able to open a new window with no URL specified in
selenium.openWindow();
it does not take any action.
please help.


On Mar 11, 10:27 am, Friendkey <friend...@gmail.com> wrote:
> Thank you all. I worked it out!

> Thewindowname is right, it'sselenium'sfault. It seems thatseleniumdoesn't know thewindowopened by my web page. It can only
> recognizewindowopened by itself.
> So the workaround is:
> 1. open awindowbyseleniumwith the same name as the targetnewwindow, for example:selenium.openWindow('', 'MyWindow')


> 2. click button (byselenium) to open thenewwindow, for example:selenium.click(locator)

>         comment: thewindowname is "MyWindow" (same as previous).
> Firefox won't open anewwindow, but use thewindowopened by last


> step
> 3. now, selectWindow is able to recognize "MyWindow"
>
> Hopes it helps people encounters the similar problem.
>
> On Mar 10, 3:54 pm, Ritesh <riteshsgs...@gmail.com> wrote:
>
>
>
> > Hi,
>

> > You need to focus thenewwindow, first try to find out name ofnew
> >windowusingseleniumIDE (for this just record anything fromnew


> >window) then use bellow code
>
> >selenium.click(locator);

> >selenium.selectWindow("windowname");


> >selenium.windowFocus();
>
> > Thanks
> > Ritesh
>
> > On Mar 8, 7:58 am, Friendkey <friend...@gmail.com> wrote:
>
> > > Hi,
>
> > >Seleniumdoesn't recognize mynewwindow.

> > > Thenewwindowis created by submit a form with target="uploadWindow".


> > > All I know is use "selectWindow" to operate on thenewwindow.
> > > The script recorded byseleniumIDE:
>
> > > click   link=Upload CSV
> > > selectWindow    name=uploadWindow
>
> > > But it says cannot find thewindowwhen replay the script.
>

> > > I triedseleniumRC, and the result is the same.
> > > And then I tried to use "all_window_names" inselenium-RC to see


> > > whether the name is right, but thenewwindowisnotlisted.
>
> > > Above is done on Firefox.
>

Reply all
Reply to author
Forward
0 new messages