title: Webdriver doesn't stable and sometimes crashes during the running
body: <p>Sometimes the webDriver stopped during the running and warn about "no session"/ "no window target" and etc..</p>
  
  <p>I've used Protractor on Node.JS for my automated testing.</p>
  
  <p>The errors are not Constantine and sometimes all the 200 test cases are work fine until the end of the running.</p>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>10:38:20.745 INFO - Executing: [get current url])
  10:38:20.766 INFO - Done: [get current url]
  10:38:20.799 INFO - Executing: [take screenshot])
  10:38:21.299 INFO - Done: [take screenshot]
  10:38:22.002 INFO - Executing: [get: http://app.vcita.com/auth/login])
  10:38:27.870 INFO - Done: [get: http://app.vcita.com/auth/login]
  10:38:29.917 INFO - Executing: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]])
  10:38:30.009 INFO - Done: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]]
  10:38:30.049 INFO - Executing: [is enabled: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -&gt; css selector: [ng-click="connectWithGoogle()"]]])
  10:38:30.148 INFO - Done: [is enabled: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -&gt; css selector: [ng-click="connectWithGoogle()"]]]
  10:38:30.243 INFO - Executing: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]])
  10:38:30.341 INFO - Done: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]]
  10:38:30.387 INFO - Executing: [is displayed: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -&gt; css selector: [ng-click="connectWithGoogle()"]]])
  10:38:30.467 INFO - Done: [is displayed: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -&gt; css selector: [ng-click="connectWithGoogle()"]]]
  10:38:30.523 INFO - Executing: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]])
  10:38:30.569 INFO - Done: [find elements: By.cssSelector: [ng-click="connectWithGoogle()"]]
  10:38:30.613 INFO - Executing: [click: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -&gt; css selector: [ng-click="connectWithGoogle()"]]])
  10:38:30.760 INFO - Done: [click: 762 [[ChromeDriver: chrome on XP (4c9896194733dc6b787bf75f84f48ec2)] -&gt; css selector: [ng-click="connectWithGoogle()"]]]
  10:38:32.812 INFO - Executing: [get window handles])
  10:38:32.842 INFO - Done: [get window handles]
  10:38:34.873 INFO - Executing: [get window handles])
  10:38:34.908 INFO - Done: [get window handles]
  10:38:34.961 INFO - Executing: [switch to window: CDwindow-FC9091C4-87E2-45A2-B125-D658EADF49ED])
  10:38:35.009 INFO - Done: [switch to window: CDwindow-FC9091C4-87E2-45A2-B125-D658EADF49ED]
  10:38:35.037 INFO - Executing: [find elements: By.id: choose-account-0])
  10:38:38.163 WARN - Exception thrown
  java.lang.NullPointerException
          at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:386)
          at org.openqa.selenium.remote.RemoteWebDriver.findElementsById(RemoteWebDriver.java:397)
          at org.openqa.selenium.By$ById.findElements(By.java:206)
          at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:340)
          at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
          at com.sun.proxy.$Proxy1.findElements(Unknown Source)
          at org.openqa.selenium.support.events.EventFiringWebDriver.findElements(EventFiringWebDriver.java:173)
          at org.openqa.selenium.remote.server.handler.FindElements.call(FindElements.java:49)
          at org.openqa.selenium.remote.server.handler.FindElements.call(FindElements.java:1)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
  10:38:38.454 WARN - Exception: null
  10:38:39.551 INFO - Executing: [take screenshot])
  10:38:39.584 WARN - Exception thrown
  org.openqa.selenium.NoSuchWindowException: no such window: target window already closed
  from unknown error: web view not found
    (Session info: chrome=48.0.2564.109)
    (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 22 milliseconds
  Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
  System info: host: 'vCitaQA', ip: '10.0.0.5', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_65'
  Driver info: org.openqa.selenium.chrome.ChromeDriver
  Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir9468_8071}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=48.0.2564.109, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
  Session ID: 4c9896194733dc6b787bf75f84f48ec2
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
          at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
          at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:622)
          at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:324)
          at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:35)
          at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:1)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:168)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
  10:38:39.965 WARN - Exception: no such window: target window already closed
  from unknown error: web view not found
    (Session info: chrome=48.0.2564.109)
    (Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Windows NT 10.0 x86_64) (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 22 milliseconds
  Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
  System info: host: 'vCitaQA', ip: '10.0.0.5', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_65'
  Driver info: org.openqa.selenium.chrome.ChromeDriver
  Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=C:\Users\idan\AppData\Local\Temp\scoped_dir9468_8071}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=48.0.2564.109, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
  Session ID: 4c9896194733dc6b787bf75f84f48ec2
  </code></pre>
  
  <p>Please help me to figure out why it happens and what the better solution to avoid it.. </p>
  
  <p>Thanks.</p>