Protractorのwebdriver.createSessionのエラー対処



# CircleCiで、firefoxが死ぬてエアーに遭遇した場合

## まず、試すべき

```
yarn webdriver-manager update
```

## ダメだったら

CircleCIで、browersを使っているのでfirefoxもインストールされているはず!

```
version: 2
jobs:
  build:
    docker:
      - image: circleci/node:6.14-browsers
```

でも、実際に走らせてみると、なぜかdriver unknownになってしまう。

```
[06:00:30] I/launcher - Running 1 instances of WebDriver
[06:00:30] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[06:01:31] E/launcher - connection refused
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z'
System info: host: 'f2e822041889', ip: '172.20.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-139-generic', java.version: '1.8.0_171'
Driver info: driver.version: unknown
remote stacktrace: 
[06:01:31] E/launcher - WebDriverError: connection refused
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:19.891Z'
System info: host: 'f2e822041889', ip: '172.20.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-139-generic', java.version: '1.8.0_171'
Driver info: driver.version: unknown
remote stacktrace: 
    at WebDriverError (/home/circleci/repo/node_modules/selenium-webdriver/lib/error.js:27:5)
    at Object.checkLegacyResponse (/home/circleci/repo/node_modules/selenium-webdriver/lib/error.js:546:15)
    at parseHttpResponse (/home/circleci/repo/node_modules/selenium-webdriver/lib/http.js:509:13)
    at doSend.then.response (/home/circleci/repo/node_modules/selenium-webdriver/lib/http.js:441:30)
    at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
    at Function.createSession (/home/circleci/repo/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
    at Function.createSession (/home/circleci/repo/node_modules/selenium-webdriver/firefox/index.js:521:41)
    at createDriver (/home/circleci/repo/node_modules/selenium-webdriver/index.js:170:33)
    at Builder.build (/home/circleci/repo/node_modules/selenium-webdriver/index.js:632:16)
    at Hosted.getNewDriver (/home/circleci/repo/node_modules/protractor/built/driverProviders/driverProvider.js:53:33)
    at Runner.createBrowser (/home/circleci/repo/node_modules/protractor/built/runner.js:195:43)
    at q.then.then (/home/circleci/repo/node_modules/protractor/built/runner.js:339:29)
    at _fulfilled (/home/circleci/repo/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/home/circleci/repo/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/home/circleci/repo/node_modules/q/q.js:796:13)
[06:01:31] E/launcher - Process exited with error code 199
error Command failed with exit code 199.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1
```

いろいろデバックして見た結果、いろいろバージョンがあってないのが原因だった。
node-browsersの中のfirefoxのバージョンがかなり低い`v48` それは、動かないわ

```
 - run:
     name: Install firefox
     command: |
       wget 'https://ftp.mozilla.org/pub/firefox/releases/60.0.1/linux-x86_64/en-GB/firefox-60.0.1.tar.bz2'
       tar xvf firefox-60.0.1.tar.bz2
```

を入れて、最新版を更新して、firefox_binaryを`protractor.conf.js`に入れれば動く!!!

```
 'firefox_binary': '/home/circleci/repo/firefox/firefox'
```