title: Javascript - UnknownError: Error communicating with the remote browser. It may have died
body: <pre><code>INFOS
    Node v4.4.7
    Protractor v4.0.2
    Gulp CLI version 3.9.1
    Gulp Local version 3.9.1
    Chromedriver chromedriver_2.22.exe
    SeleniumServerJar selenium-server-standalone-2.53.1.jar
    Chrome Browser version=52.0.2743.82 m
  
  SYSTEM INFO:
      host: 'win10', ip: '**', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', 
      java.version: '1.8.0_102'
  </code></pre>
  
  <p>I am using the Bamboo server to run my Protractor e2e tests via gulp and the tests PASS but at the very end throw this error: <code>"UnknownError: Error communicating with the remote browser. It may have died."</code> </p>
  
  <p>I have tried adding the following code snippet at the very end of my feature step JavaScript code as a way to tell Protractor to NOT end prematurely and wait for Angular to finish all of its asynchronous work but this attempt also failed: </p>
  
  <pre><code> return browser.waitForAngular().then(function () {
        console.log('\n Waiting for angular to avoid this issue: 
        UnknownError: Error communicating with the remote browser. It may have died.');
        browser.driver.sleep(10000);
       });
  </code></pre>
  
  <p>Also notice there's a sleep in there, still didn't work.</p>
  
  <p><strong><em>This error only happens when I'm executing my e2e tests via the Bamboo agent in our Windows VM</em></strong>; however if I run same test locally on the command prompt, <strong><em>they pass with no problem</em></strong>.</p>
  
  <p>Lastly when my bamboo agent runs these e2e tests in my Windows10 VM, I do NOT see a browser open so looks like they're executing headlessly see protractor config below:</p>
  
  <pre><code>exports.config = {
    framework: 'cucumber',
    chromeDriver: "C:/Users/someUser/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver_2.22.exe",
    seleniumServerJar: "C:/Users/someUser/AppData/Roaming/npm/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar",
  
    capabilities: {
      'browserName': 'chrome',
      'chromeOptions': {
        'args': ['--no-sandbox']
      }
    },
  </code></pre>
  
  <p>Notice there's no PhantomJs browser as it's discouraged by the Protractor team, they don't use it themselves; so I use Chrome it seems to run headlessly because I never see it open up but I know the test are running from the log file output, see image below and notice how the test PASSED but the Bamboo test plan failed with that error in image below. 
  <a href="https://i.stack.imgur.com/vKjid.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vKjid.png" alt="enter image description here"></a></p>
  
  <p>Any ideas on this? </p>