Selenium not detecting the second window in IE

how to switch to new window in ie using selenium
switch to default window in selenium
selenium new window
ie 11 webdriver windows 10
org openqa selenium nosuchwindowexception unable to get browser
how to transfer control to new tab using selenium webdriver

My application opens up a new window on clicking a button and i need to perform some actions in that window. But the response getWindowHandles() method of selenium webdriver has only one window id in it. This happens especially if there is a delay in calling the getWindowHandles() after opening the new window. There is a known issue with selenium.

But even the solution for that is not working for me.

Code is as follows

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
RemoteWebDriver driver = new
        RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);


WebElement userName = driver.findElement("usr_name"));

WebElement password = driver.findElement("usr_password"));

WebElement login = driver.findElement("OK"));;  

WebElement popup= driver.findElement("popup"));;      


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

The Set "windowHandles" will return only one window :


But if i remove the sleep. it will return two window ids :

[90cc6006-0679-450c-a5b3-6602bcb41a16, 7211bbfd-2616-4460-97e7-56c0e632c3bb]

I cannot remove the sleep as this is just a sample program and in the real application there will be some delay in between. Please let me know your thoughts.This issue is only for IE11.

Blue screen - Home Page; Grey Screen - Popup

Switch tabs using Selenium WebDriver with Java, Using to get the handle of the popup browser window will be unreliable with IE. You should implement a strategy by which you discover what the  OS: Windows 10 Selenium-Java Version: 3.12.0 Browser: Internet Explorer 11. While trying to perform a basic Authentication to one of my application using selenium, the code is unable to detect the presence of Alert window. This was working fine with Windows 7 & IE 11. But when the OS got upgraded to Windows 10, application is indefinitely

Window handling issue, is mainly because of protected mode settings. Either enable protected mode for all the zones or disable it for all the zone and try.

How to select an default window or popup in selenium webdriver , Selenium not detecting the second window in IE. how to switch to new window in ie using selenium selenium new window ie 11 webdriver windows 10 switch to   If any IE driver commands show instability, try re-testing using Javascript. If you attempt to hover over elements and your physical mouse cursor is within the boundaries of the IE browser window, the hover state will appear for an instant and then disappear. There is no known workaround for this behavior.

Dunno what is Set, but I tested with following code

while (true)
                int qw = ololo.WindowHandles.Count;
                string[] wh = ololo.WindowHandles.ToArray();

And it worked perfectly.

switch to new window not working in IE11 windows 7 in selenium, Some web applications have many frames or multiple windows. handle of second window, extracting the handle which does not match to first window handle. As far as I know there is no cross-browser method that Selenium provides to detect that it is driving the browser. In FF, webdriver sets the webdriver attribute on the html element but apparently not in other browsers. Maybe some day this will be the way to detect that the browser is being driven by Selenium but not for now. I've just tested it

On IE11, "Enable Protected Mode" setting on the browser is key - can be either ON or OFF (for all zones).

Other settings on driver capabilities didn't matter (in my case) - following worked just as fine:

		caps.setCapability("ignoreZoomSetting", false);
		caps.setCapability("nativeEvents", false); 
		caps.setCapability("ignoreProtectedModeSettings", false);

Not able to use switchto new window with Selenium 2, Anyone that has worked with Selenium 2.0 WebDriver and IE will tell you how challenging it can be. But there are three common issues that most people new. Your browser does not currently recognize any of the video formats available. For 32-bit Windows installations, the key you must examine in the registry editor :. Second, you automatically assume that the last window returned by getWindowHandles() will be the last one opened. That's not necessarily true, as they are not guaranteed to be returned in any order. I am unable to reproduce your issue, using a C# port of your sample code that properly identifies the popup window handle.

Selenium not detecting the second window in IE, A possibly much simpler solution would be this: driver.SwitchTo().Window(driver.​WindowHandles.Last()); .Last() will just switch to the most recently opened  Meta - OS: Windows 10 Selenium Version: 3.4.0 Browser: Internet Explorer 11 Hi Team, I have the below scripts which was working perfectly fine in my laptop with Windows 7 and IE11. I had to change my laptop with Windows 10 following whic

Selenium Webdriver Switch commands | Selenium Tutorials, Navigating to a directory will open a Windows Explorer window, not open the The W3C WebDriver Specification recently added the ability to create a new The algorithm used by the IE driver to detect obscured elements checks the value of  while using IE webdriver, pdf is not loaded on the new window, the new window is blank and doesnt have any content. It works well with Chrome-driver and also manually on IE The new window also doesnt get detected with selenium. with IE driver, do we have any limitations with PDF viewing ? html code

Selenium WebDriver Fix For 3 Common IE Browser Errors, How to run Selenium Webdriver test in IE browser / Internet Explorer Driver. March 10 the Microsoft Edge browser as well which is an added advantage for Windows 10 users. Your browser does not currently recognize any of the video formats available. WebDriver driver=new InternetExplorerDriver();. Hi praveen, Here are some of the steps to ensure before working on IE[not worked on chrome] 1) setting up the uniform protection mode for all the zones. 2) setting the zoom level to 100%. 3) below one is not mandatory, its only to avoid any update which can affect your application failing test cases. Here is the below registry change I did for making my things work as usual. [HKEY_LOCAL

  • Could you give a whole screen shot of your pop up? I want to indentify it's a actual new browser window/Tab or simulated pop-up
  • @yong Added the screenshot
  • Which one is the pop-up you mean? The big window with gray background? or the small one with white background the most front?
  • The big window with grey background. What you see behind that (blue background), is the parent window.
  • Try the solution in this post. If not fix your issue, then try use latest IEDriver
  • I tried all these, but dint worked. I agree that 'Thread.sleep()' is not a good practice. I was trying to simulate the delay in actual code using sleep(). (what i have given in the question is a sample code for testing, not the actual code in production). I have even removed the 'sleep()' and kept a scanner in between, so that rest of the code works only on receiving my input. It looks like the webdriver is loosing the second window when there a delay in accessing the second window.
  • "Enable Enhanced Protected Mode" is in the advanced tab. I talked to IT department about setting the 'Enable Protected Mode', but they said it is difficult.
  • Is the desiredCapabilites retained in the new winodow that opens? or some additional configuration is needed for that.
  • "Enable Enhanced Protected Mode" is unchecked in IE options.
  • I am not able to enable it for local intranet and Trusted sites zones. It is a company provided laptop and these are set based on user groups. Any other solutions?
  • No other way. Its all have to be same. Raise an exception at your organization and get it approved. This is a required configuration and not an available configuration.
  • Switch your testing to Google Chrome. I avoid IE like the plague.