Selenium server pre-running?

Does anyone know if the circle build environment comes with selenium server? I’m trying to run a Node.js script that uses the local selenium server but it fails with this error:

{ Error: Couldn't connect to selenium server
    at end() - take-screenshots.js:40:8
  message: 'Couldn\'t connect to selenium server',
  type: 'RuntimeError',
  seleniumStack: 
   { status: -1,
     type: 'ECONNREFUSED',
     message: 'Couldn\'t connect to selenium server',
     orgStatusMessage: 'Couldn\'t connect to selenium server' } }

The script looks like this:

const webdriverio = require('webdriverio')
const baseURL = 'http://localhost:5000'
const dir = process.env.CIRCLE_ARTIFACTS
const scr = str => dir + '/' + str
const u = str => baseURL + str

const client = webdriverio
  .remote({ desiredCapabilities: { browserName: 'chrome' } })
  .init()

    client
      .init()
      .url(u('/'))
      .saveScreenshot(scr('homepage.png'))
      .end()

The script works fine on my local machine with selenium-server running.

There is no mention of selenium server on the listings of software installed on the build images in the docs.

You can add it via circle.yml easily enough:

    - wget http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-    2.44.0.jar
    - java -jar selenium-server-standalone-2.44.0.jar:
        background: true
1 Like

Thanks, that’s what I ended up doing (with caching). I had to use phatomjs though because I couldn’t get chrome to work (it would just hang or tell me there was an error when connecting).

dependencies:
  cache_directories:
    - "~/cache"
  pre:
    - mkdir -p ~/cache
  post:
    # only downloads if not already in cache
    - cd ~/cache && wget -nc http://selenium-release.storage.googleapis.com/3.0/selenium-server-standalone-3.0.1.jar
    - java -jar ~/cache/selenium-server-standalone-3.0.1.jar:
          background: true