Register Now

Integrating Selenium with Codeship


Reading Time: 2 minutes

At Codeship, we’re pleased to be able to integrate with several third-party products across a variety of areas to ensure your CI/CD workflows are that much smoother. For example, Selenium, according to Wikipedia, “is a portable software-testing framework for web applications,” providing a “playback tool for authoring tests without the need to learn a test scripting language.”

Let’s walk through the requirements for running browser testing with Selenium in your CI/CD pipeline with Codeship Basic and Codeship Pro.

Browser Testing for Codeship Basic

Codeship Basic uses fast, performant VMs with preinstalled technology stacks to make it super easy and fast to get started running a CI/CD pipeline.

Chrome and Firefox both work with Selenium. To support Selenium with Chrome, be sure to update ChromeDriver to the desired version for your application. Please provide your own Selenium driver in your application and keep it current.

Selenium standalone server

If there are no packages available for your framework or you want to use the standalone version, there is a script available for installing a custom version.

Browser Testing For Codeship Pro

Codeship Pro uses containers built from Docker images to let you define and build your own completely flexible CI/CD environment. To use the standalone Selenium server, you need to download the Selenium jar file in your Dockerfile.

# Starting from Ubuntu Xenial
FROM ubuntu:xenial

# We need wget to download Selenium Server and openjdk-8-jdk
RUN apt-get update
RUN apt-get install -y wget openjdk-8-jdk

# Set up Selenium environment variables

# Download Selenium Server
RUN wget -q --continue --output-document /selenium-server.jar ""

Then as part of your build script, you simply start the Selenium server with the jar file and wait a few seconds for it to properly load.

java -jar /selenium-server.jar -port "${SELENIUM_PORT}" ${SELENIUM_OPTIONS} 2>&1 &
echo "Selenium is now ready to connect on port ${SELENIUM_PORT}"

Subscribe via Email

Over 60,000 people from companies like Netflix, Apple, Spotify and O'Reilly are reading our articles.
Subscribe to receive a weekly newsletter with articles around Continuous Integration, Docker, and software development best practices.

We promise that we won't spam you. You can unsubscribe any time.

Join the Discussion

Leave us some comments on what you think about this topic or if you like to add something.