title: Running selenium-chromedriver using Protractor on linux
body: <p>I am using protractor to run tests against an Angular application. They work on my OSX environment but not on Linux where TeamCity is trying to run it.</p>
  
  <p>When I run this command on my local OSX environment, it works (tested on my co-workers machine, too):</p>
  
  <pre><code>./node_modules/protractor/bin/protractor protractor.conf.js
  
  Using ChromeDriver directly...
  ..
  Finished in 5.55 seconds
  2 tests, 2 assertions, 0 failures
  </code></pre>
  
  <p>When I run this on a linux machine, or a TeamCity job tries to run it, it fails:</p>
  
  <pre><code>./node_modules/protractor/bin/protractor protractor.conf.js
  
  Using ChromeDriver directly...
  
  /usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:87
            Error('Timed out waiting for the WebDriver server at ' + url));
            ^
  Error: Timed out waiting for the WebDriver server at http://127.0.0.1:52959/
      at Error (&lt;anonymous&gt;)
      at onResponse (/usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:87:11)
      at /usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/http/util.js:42:21
      at /usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/http/http.js:96:5
      at ClientRequest.&lt;anonymous&gt; (/usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:136:7)
      at ClientRequest.EventEmitter.emit (events.js:95:17)
      at Socket.socketErrorListener (http.js:1547:9)
      at Socket.EventEmitter.emit (events.js:95:17)
      at net.js:440:14
      at process._tickCallback (node.js:415:13)
  ==== async task ====
  WebDriver.createSession()
      at Function.webdriver.WebDriver.acquireSession_ (/usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:131:49)
      at Function.webdriver.WebDriver.createSession (/usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:111:30)
  </code></pre>
  
  <h2>Attempts to resolve:</h2>
  
  <p>I have looked at <a href="https://stackoverflow.com/questions/20555953/protractor-stand-alone-selenium-fails-error-timed-out-waiting-for-the-webdrive?rq=1">this issue</a>, but a standalone webdriver server is no solution.</p>
  
  <p>I looked at <a href="https://stackoverflow.com/questions/23546919/node-selenium-webdriver-error-timed-out-waiting-for-the-webdriver-server-at">this issue</a> but my version of selenium-wedriver is <code>2.42.1</code>, so, not the same bug.</p>
  
  <h2>Versions:</h2>
  
  <pre><code>$ node --version
  v0.10.26
  
  $ ./node_modules/protractor/bin/protractor --version
  Version 1.0.0
  
  $ uname -mrs
  Linux 3.11.0-15-generic x86_64
  </code></pre>
  
  <h2>Progress Update:</h2>
  
  <p>Trying to get the version of <code>chrome-webdriver</code> exposed a problem:</p>
  
  <pre><code>$ ./node_modules/protractor/selenium/chromedriver --version
  ./node_modules/protractor/selenium/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
  </code></pre>
  
  <p>From this I concluded there was a dependency issue and found that <a href="http://forum.codio.com/t/selenium-web-driver-errors/410" rel="nofollow noreferrer">Selenium requires Chrome</a>. <a href="https://code.google.com/p/chromedriver/issues/detail?id=790" rel="nofollow noreferrer">(more)</a>.</p>
  
  <p>I installed Chrome on the Linux box using <a href="https://askubuntu.com/questions/79280/how-to-install-chrome-browser-properly-via-command-line">steps like this</a>:</p>
  
  <pre><code>sudo apt-get install libxss1 libappindicator1 libindicator7
  sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
  sudo dpkg -i google-chrome*.deb
  </code></pre>
  
  <p>This didn't work exactly like that, but after a few back and forths with dependencies and <code>sudo apt-get install</code> I think I got Chrome installed:</p>
  
  <pre><code>$ google-chrome --version
  Google Chrome 36.0.1985.143 
  </code></pre>
  
  <p>This made the chromedriver version work:</p>
  
  <pre><code>$ ./node_modules/protractor/selenium/chromedriver --version
  ChromeDriver 2.10.267518
  </code></pre>
  
  <p>However, running Protractor still does not work:</p>
  
  <pre><code>$ ./node_modules/protractor/bin/protractor protractor.conf.js
  Using ChromeDriver directly...
  
  /usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109
    var template = new Error(this.message);
                   ^
  UnknownError: unknown error: Chrome failed to start: exited abnormally
    (Driver info: chromedriver=2.10.267518,platform=Linux 3.11.0-15-generic x86_64)
      at new bot.Error (/usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109:18)
      at Object.bot.response.checkResponse (/usr/share/TeamCity/buildAgent/work/57bd89f9c9abb5d5/webapp/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/response.js:106:9)
  </code></pre>