9

Im using CircleCI and I want to run Huxley tests.

But for that i need selenium server running.

I was trying to run selenium server standalone jar. Thats not solution.

Please help if you know something.

Sebastian Wozny
  • 16,943
  • 7
  • 52
  • 69
Michael Czolko
  • 2,698
  • 2
  • 15
  • 25

2 Answers2

28

Most browser-testing frameworks will include Selenium for you. If you need to run a standalone Selenium server, you can add the following to a circle.yml in your repo's root directory:

dependencies:
   post:
      - wget https://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

That will download the latest standalone Selenium jar and run it in the background. Note the colon at the end of the second command and the 4 space indentation of "background: true". That tells YAML to treat background as a modifier to the command.

More documentation here:

https://circleci.com/docs/background-process

https://circleci.com/docs/installing-custom-software

NOTE: if you update the link to JAR in this answer, please, make sure that it is HTTPS. It's generally considered dangerous to download something over unsafe HTTP and just run it without checking the checksumms, because of possibility of man-in-the-middle attack resulting in the JAR replacement/tampering.

Ivan Kolmychek
  • 1,261
  • 1
  • 9
  • 17
Daniel Woelfel
  • 518
  • 5
  • 13
5

Install the full Stack of selenium, chromedriver and chrome:

dependencies:
  pre:

  # Install Selenium.
  - curl http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar > selenium-server-standalone.jar
  - curl http://chromedriver.storage.googleapis.com/2.23/chromedriver_linux64.zip | gzip -dc > chromedriver
  - chmod +x chromedriver
  - 'java -jar selenium-server-standalone.jar -trustAllSSLCertificates -Dwebdriver.chrome.driver=chromedriver':
        background: true
  # Update Google Chrome.
  - google-chrome --version
  - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
  - sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb stable main" >> /etc/apt/sources.list.d/google.list'
  - sudo apt-get update
  - sudo apt-get --only-upgrade install google-chrome-stable
  - google-chrome --version
Alex Skrypnyk
  • 1,331
  • 13
  • 12
  • Your `curl` command for the chromedriver will not work. You can't pipe a `zip` to `gzip` for decompression. They two (2) different, incompatible compression schemes. The following however will work: `curl https://chromedriver.storage.googleapis.com/2.33/chromedriver_mac64.zip -O && unzip chromedriver_mac64.zip` – javafueled Nov 30 '17 at 00:17
  • @javafueled How it could not work if it has been working on 20+ projects – Alex Skrypnyk Dec 04 '17 at 04:03
  • [Can `gunzip` extract a .zip archive?](http://www.gzip.org/#faq17). `gunzip` is just `gzip -d`. In fact, every time I attempt this, I'm told `gzip: unknown compression format` (with Linux and Mac versions). I, _respectfully_, remain unconvinced the pipe is doing what the pipe is thought to be doing. – javafueled Dec 05 '17 at 02:15