title: Selenium tests fail on remote machine for chrome and ie drivers
body: <p>I am using selenium grid with testng for distributed testing.
  I want to run tests on remote machine on chrome and IE browsers. But the tests fail with exception on these two browsers. When tests are run on Firefox, the run is successful.</p>
  
  <p>Here is the code used for initializing browsers:</p>
  
  <pre class="lang-java prettyprint-override"><code>DesiredCapabilities cap = new DesiredCapabilities();
  cap.setBrowserName("chrome");
  cap.setPlatform(Platform.WINDOWS);
  driver = new RemoteWebDriver(new URL(URL),cap);
  driver.get(myURL);
  </code></pre>
  
  <p>The browsers are successfully initialized. The tests fail while finding element and sending keys.
  The code which finds element is :</p>
  
  <pre class="lang-java prettyprint-override"><code>driver.findElement(By.xpath(Xpath_Username)).sendKeys("abc");
  </code></pre>
  
  <p>I am using my machine as hub and another machine as node. Node is connected to hub using below command :</p>
  
  <pre class="lang-sh prettyprint-override"><code>java -jar selenium-server-standalone-2.47.1.jar -role webdriver -hub http://*myip*:4444/grid/register -port 8989 -browser browserName="chrome",version=ANY,platform=VISTA,maxInstances=5 -Dwebdriver.chrome.driver=D:\chromedriver.exe -browser browserName="internet explorer",version=ANY,platform=VISTA,maxInstances=2 -Dwebdriver.ie.driver=D:\IEDriverServer.exe
  </code></pre>
  
  <p>I am executing tests parallel using testng on different machines and browsers.
  The output of the tests :</p>
  
  <pre class="lang-java prettyprint-override"><code>Running TestSuite
  Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 7.068 sec &lt;&lt;&lt; FAILURE! - in TestSuite
  remoteTest(testproject.testclass)  Time elapsed: 2.313 sec  &lt;&lt;&lt; FAILURE!
  org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 13 milliseconds
  Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
  System info: host: hostname, ip: 'ip', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_51'
  Driver info: org.openqa.selenium.ie.InternetExplorerDriver
  Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version
  ntCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
  Session ID: f3667158-1a65-4c24-866a-3d1c5444918b
  *** Element info: {Using=xpath, value=//input[@id='login']}
  Command duration or timeout: 214 milliseconds
  Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44'
  System info: host: 'hostname', ip: 'ip', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_51'
  Driver info: org.openqa.selenium.remote.RemoteWebDriver
  Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version
  criptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
  Session ID: d93bfa55-13b2-427f-b11d-fca5417a0d91
  *** Element info: {Using=xpath, value=//input[@id='login']}
          at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:138)
          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
          at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
          at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:445)
          at org.openqa.selenium.By$ByXPath.findElement(By.java:358)
          at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:340)
          at testproject.Browser.login(Browser.java:44)
          at testproject.testclass.remoteTest(testclass.java:10)
  Caused by: org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 13 milliseconds
  Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
  System info: host: 'hostname', ip: 'ip', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_51'
  Driver info: org.openqa.selenium.ie.InternetExplorerDriver
  Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version
  ntCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
  Session ID: f3667158-1a65-4c24-866a-3d1c5444918b
  *** Element info: {Using=xpath, value=//input[@id='login']}
  Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44'
  System info: host: 'hostname', ip: 'ip', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_51'
  Driver info: driver.version: EventFiringWebDriver
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
          at java.lang.reflect.Constructor.newInstance(Unknown Source)
          at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
          at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
          at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
          at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:445)
          at org.openqa.selenium.By$ByXPath.findElement(By.java:358)
          at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:340)
          at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:102)
          at com.sun.proxy.$Proxy3.findElement(Unknown Source)
          at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:185)
          at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:48)
          at org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:1)
          at java.util.concurrent.FutureTask.run(Unknown Source)
          at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
  
  
  Results :
  
  Failed tests:
    testclass.remoteTest:10-&gt;Browser.login:44 ? NoSuchWindow Unable to find elemen...
  
  Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
  
  [INFO] ------------------------------------------------------------------------
  [ERROR] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] There are test failures.
  
  Please refer to D:\svn_workspace\SeleniumGrid\target\surefire-reports for the individual test results.
  [INFO] ------------------------------------------------------------------------
  [INFO] For more information, run Maven with the -e switch
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 11 seconds
  [INFO] Finished at: Tue Sep 08 14:45:39 IST 2015
  [INFO] Final Memory: 38M/260M
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p>Please provide any solution to this.</p>