TAGS :Viewed: 9 - Published at: a few seconds ago

[ RemoteWebDriver works once, then throws NoSuchWindowException ]

I've come upon a strange issue while setting up a Selenium Grid. My RemoteWebDriver works once, and then throws a NoSuchWindowException if I try to do anything else with it.

For example, if I run the following test (which I wrote just to explore this problem):

@Test
public void testStuff() {
    try{Thread.sleep(2000);}catch(Exception e){}
    driver.get("http://www.google.com");
    try{Thread.sleep(2000);}catch(Exception e){}
    driver.get("http://www.stackoverflow.com");
    System.out.println(driver.getTitle());
}

An IE browser pops up on the virtual machine that I'm sending it to. That browser then successfully goes to google. However, when I try to do anything else with it (like go to another website, or get the window's title), I get the following exception:

org.openqa.selenium.NoSuchWindowException: Unable to get browser(WARNING: The server did not provide any stacktrace information)

I have tried all sorts of combinations, with the same result every time: I can successfully call a method off of the RemoteWebDriver once, but the second time it throws this exception.

Does anyone have any ideas what might be causing it?

Things I've checked:

  • The IEDriverServer and the VM are both 64-bit.
  • The console for both the Hub and the Node yield no useful clues. The Node console contains:

     INFO - Executing: [get: http://www.google.com] at URL: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url)
     INFO - Done: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url
     INFO - Executing: [get: http://www.stackoverflow.com] at URL: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url)
     INFO - Done: /session/de0a7b62-33a1-4330-b9a9-25b99f5504-cf/url
     WARN - Exception thrown
     org.openqa.selenium.NoSuchWindowException: Unable to get browser (WARNING: The server did not provide any stacktrace information)
  • In response to Richard's comment, the WebDriver really is quitting at then end of the test. I'm printing out the following in the console:

    successfully strt RemoteWebDriver: internet explorer on WINDOWS (40b01604-9217-4f67-b809-61cd90d23c84) preparing to quit RemoteWebDriver: internet explorer on WINDOWS (40b01604-9217-4f67-b809-61cd90d23c84) successfully quit RemoteWebDriver: internet explorer on WINDOWS (null)

  • Also, in the Task Manager on the VM, the "IEDriverServer" process goes away at the end of the test. But the weird thing is, The browser itself does not close. I have no idea what could be causing that, and whether or not it is related.

Answer 1


That sounds to me as beeing a typical problem with the IEDriverServer.exe, occurring if configuration on a node machine isn't done properly.

Be shure to follow all requirements described on Selenium Website. Corresponding part cited here:

Required Configuration

  • The IEDriverServer exectuable must be downloaded and placed in your PATH.
  • On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
  • Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
  • The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
  • For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

I had the same issue and was able to solve it with these hints.