Issue 3835 in selenium: With multiple browsers open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7

20 views
Skip to first unread message

sele...@googlecode.com

unread,
May 1, 2012, 4:02:19 PM5/1/12
to selenium-develope...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Status-Untriaged

New issue 3835 by bmacal...@pch.com: With multiple browsers open
driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7
http://code.google.com/p/selenium/issues/detail?id=3835



What steps will reproduce the problem?
1. Using remotedriver Open site "https://online.citibank.com"
2. click on the facebook link bottom right to open a new browser instance
3. Then get the Set of open window handles as follows
driver.getWindowHandles()

What is the expected output?
I expect a set of 2

What do you see instead?
A set of 1 the original window handle

See code at bottom

Selenium version: Selenium server 2.21.0
OS: XP
Browser: IE
Browser version: 8


DesiredCapabilities capability = new DesiredCapabilities();
RemoteWebDriver driver = null;
try {
capability.setBrowserName("internet explorer");
capability.setVersion("7");
capability.setPlatform(Platform.XP);
driver = new RemoteWebDriver(new URL("http://27.101.1.199:4444/wd/hub"),
capability);
} catch (MalformedURLException e) {
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);

driver.get("https://online.citibank.com");
String myWindowHandle = driver.getWindowHandle();
driver.findElement(By.id("cmlink_FacebookIconLink")).click();
// sleep for a bit
try {
Thread.sleep(3000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Returns a set of 1 in IE 8 returns a set of 2 in IE 7
Set<String> handles = driver.getWindowHandles() ;

for(String winHandle : driver.getWindowHandles()){
if(myWindowHandle.equalsIgnoreCase(winHandle))
continue;
driver.switchTo().window(winHandle);
}
String shipperURL = driver.getCurrentUrl();
driver.close();
driver.switchTo().window(myWindowHandle);





sele...@googlecode.com

unread,
May 3, 2012, 10:48:37 AM5/3/12
to selenium-develope...@googlegroups.com
Updates:
Labels: Component-WebDriver Browser-IE Lang-Java

Comment #1 on issue 3835 by barancev: With multiple browsers open
driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7
http://code.google.com/p/selenium/issues/detail?id=3835

(No comment was entered for this change.)

sele...@googlecode.com

unread,
Aug 10, 2012, 3:55:50 AM8/10/12
to selenium-develope...@googlegroups.com

Comment #2 on issue 3835 by v...@milestonesys.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

I am having the same problem

sele...@googlecode.com

unread,
May 8, 2013, 5:52:43 AM5/8/13
to selenium-develope...@googlegroups.com
Updates:
Status: NeedsClarification

Comment #3 on issue 3835 by a.u.savchuk: With multiple browsers open
driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7
http://code.google.com/p/selenium/issues/detail?id=3835

Hi!

Is this issue still reproduced at last selenium version?
I can not reproduce it at my win7+ie8. Test code is attached.

If it is reproduced please provide TRACE log from IEDriverServer

Attachments:
t.py 775 bytes

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

sele...@googlecode.com

unread,
May 19, 2013, 2:38:18 PM5/19/13
to selenium-develope...@googlegroups.com

Comment #4 on issue 3835 by barancev: With multiple browsers open
driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7
http://code.google.com/p/selenium/issues/detail?id=3835

Is this related to issue 2666?

sele...@googlecode.com

unread,
May 25, 2013, 6:13:17 PM5/25/13
to selenium-develope...@googlegroups.com

Comment #5 on issue 3835 by holeviet...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

I'm also having the same issue. When a new window is opened with
`window.open`, calling driver.window_handles only return 1 window.

OS: XP
IE8

Internet Settings with all Security on lowest possible.

sele...@googlecode.com

unread,
May 25, 2013, 6:14:17 PM5/25/13
to selenium-develope...@googlegroups.com

Comment #6 on issue 3835 by holeviet...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

This issue still occurs with Selenium 2.33. only in IE8 Windows XP

sele...@googlecode.com

unread,
Jun 5, 2013, 2:49:57 PM6/5/13
to selenium-develope...@googlegroups.com

Comment #7 on issue 3835 by a.u.savchuk: With multiple browsers open
driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7
http://code.google.com/p/selenium/issues/detail?id=3835

@holevietlong

Could you provide TRACE log from IEdriver for this problem?

sele...@googlecode.com

unread,
Jun 5, 2013, 2:53:19 PM6/5/13
to selenium-develope...@googlegroups.com

Comment #8 on issue 3835 by holeviet...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

Yup will get the TRACE log asap!

sele...@googlecode.com

unread,
Jun 7, 2013, 10:04:28 AM6/7/13
to selenium-develope...@googlegroups.com

Comment #9 on issue 3835 by holeviet...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

hmm... can't seem to reproduce this anymore. I'll update the ticket if I
encounter it again.

sele...@googlecode.com

unread,
Jul 30, 2013, 3:33:29 PM7/30/13
to selenium-develope...@googlegroups.com

Comment #10 on issue 3835 by brentbar...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

I am able to reproduce this error with the following code in IE8 and XP,
using RemoteWebDriver

html code:


<!DOCTYPE html>
<html>
<title>Popup</title>
<body>

<p>Test Popup window.</p>

<button id="popupClick" onclick="popup()">Popup Window</button>

<p id="demo"></p>

<script language="javascript" type="text/javascript">
function popup() {

newwindow=window.open("http://www.google.com",'name','height=200,width=150');
if (window.focus)
{
newwindow.focus()
}
var x="You clicked the popup window!";
document.getElementById("demo").innerHTML=x;

return false;

}

</script>
</script>
</body>
</html>


selenium code:

driver.get("myHost/popupWindow.html");
driver.findElement(By.id("popupClick")).click();

for(int i = 0; i < 10; i++)
{
int handleSize = driver.getWindowHandles().size();
System.out.println("Window handle size: " + handleSize );

if (handleSize > 1) {
break;
}

try {
Thread.sleep(1000);
}
catch (Exception e) {

}
}

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

for(String handle : webHandles)
{
System.out.println("Web Handle: " + handle);
}

output in IE8 and XP:
Window handle size: 1
Window handle size: 1
...
Window handle size: 1
Web Handle: f798d416-86df-436d-b267-79ef0887a8b4

output in IE9 and windows 7
Window handle size: 1
Window handle size: 1
...
Window handle size: 1
Window handle size: 2
Web Handle: 2bd6f067-de8d-4d9e-9ce9-15c7f2769f9b
Web Handle: bfd8523d-417c-41ba-850c-e67744ed9802


standalone server debug log file is attached. not sure how to get the TRACE
log from the standalone server

Thank you for looking at this!

Attachments:
ieDriverLog.log 126 KB

sele...@googlecode.com

unread,
Aug 8, 2013, 5:17:58 PM8/8/13
to selenium-develope...@googlegroups.com

Comment #11 on issue 3835 by brentbar...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

Any news on if this will be fixed?

sele...@googlecode.com

unread,
Sep 19, 2013, 9:47:00 AM9/19/13
to selenium-develope...@googlegroups.com

Comment #12 on issue 3835 by a.u.savchuk: With multiple browsers open
driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7
http://code.google.com/p/selenium/issues/detail?id=3835

Hi!

Is this issue still reproduced?

I can not reproduce it with Winxp IE8, selenium 2.35.3.0
Test script is attached.

If this issue is still actual please recheck it with latest selenium
and provide IEdriver TRACE log.

sele...@googlecode.com

unread,
Sep 24, 2013, 1:58:33 PM9/24/13
to selenium-develope...@googlegroups.com

Comment #13 on issue 3835 by brentbar...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

Hot dog! This appears to have been fixed with the latest Server (2.35.0)
and IEDriverServer.exe (2.35.1)

Thank you for all you do!

sele...@googlecode.com

unread,
Sep 24, 2013, 5:01:10 PM9/24/13
to selenium-develope...@googlegroups.com
Updates:
Status: Fixed
Labels: -Status-Untriaged

Comment #14 on issue 3835 by barancev: With multiple browsers open
driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE 7
http://code.google.com/p/selenium/issues/detail?id=3835

OK, let's close it as fixed at last

sele...@googlecode.com

unread,
Oct 1, 2013, 5:30:12 AM10/1/13
to selenium-develope...@googlegroups.com

Comment #15 on issue 3835 by nehu.1...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
http://code.google.com/p/selenium/issues/detail?id=3835

Hi,

I am clicking on an a tag element. On click a pop-up window is opened.
While trying to get the count of windows through WebDriver getWindowHandels
I am getting only 1 count instead of 2.

A tag:
<a title="View Order details"
href="javascript:redirectToServiceDetails(&quot;250124320&quot;,&quot;250124320&quot;,&quot;A&quot;,&quot;WBC
FTTC
Provide(Simultaneous)&quot;,&quot;KENEDV&quot;,&quot;&quot;,&quot;flow5002&quot;,&quot;&quot;,&quot;&quot;)">
… </a>

Code:
weTDList.get(2).click();

String strCurrentWindow = driver.getWindowHandle();
Object [] strAllWindows = driver.getWindowHandles().toArray();
int intTotalWindows = strAllWindows.length;
if ( intTotalWindows > 1 ) {
for( int i=0; i<intTotalWindows; i++ ) {
String strWindow = ""+strAllWindows[i];
if( !strWindow.equals(strCurrentWindow) ) {
driver.switchTo().window(strWindow);
String strURL = driver.getCurrentUrl();
try {
driver.manage().deleteAllCookies();
Selenium selenium = null;
selenium = new WebDriverBackedSelenium(driver,
strURL);
selenium.windowMaximize();
} catch( Exception e ){
}
break;
}
}
} else {
strRemarks = "No additional window located";
}

Every time its returning only one window.

OS: 32-bit XP
Selenium-server: 2.35
IE Driver Server: 2.35.3
IE: 7

sele...@googlecode.com

unread,
Sep 11, 2014, 3:50:31 PM9/11/14
to selenium-develope...@googlegroups.com

Comment #16 on issue 3835 by smitha.c...@gmail.com: With multiple browsers
open driver.getWindowHandles() returns a set of 1 in IE 8 works fine in IE
7
https://code.google.com/p/selenium/issues/detail?id=3835

Issue still exists.Every time its returning only one window.

Below are the details

OS: 64-bit Windows 7
Selenium-server: 2.39
IE Driver Server: 2.39
IE: 8
Reply all
Reply to author
Forward
0 new messages