Selenium integration with Jenkins in Ubuntu

By Harikrishna Doredla

Jenkins is open-source integration tool written in Java. It can be run on cross-platforms-  Windows, Linux, Mac OS and Solaris environments. Advantage of Jenkins is in its ability to checkout test scripts from repositories in SVN, Github, Bitbucket and build the test from test scripts . Jenkins can be configured to schedule test runs like cron jobs as and when desired .

Prerequisites for Selenium integration:

Ubuntu server, Jenkins

Java , Maven, Packages for Chrome and Firefox

Here we go creating the environment with the above prerequisites

Ubuntu Server Information:  

Execute below command on terminal:

Java installation:
Execute below command on terminal:

Maven installation:
Execute this command on terminal:

Jenkins installation:
Install Jenkins from Debian package repository of Jenkins . To use this repository, first add the key to your system:

Next, add the following entry in /etc/apt/sources.list:

Packages installation for Firefox & Chrome browser:

Accept installation of fonts ( though they are not really necessary) to avoid annoying warnings.

xvfb can start a virtual X window on a server where Selenium can start the browser to run the tests.

Xvfb or X virtual frame buffer is a display server implementing the X11 display server protocol. In contrast to other display servers, Xvfb performs all graphical operations in memory without any output screen.


Configurations at Jenkins:
Plugins: Github, Xvfb



Step 1 − Go to Manage Plugins by clicking “Manage Jenkins”


Step 2 − Find the Xvfb Plugin and choose to install. Restart the Jenkins instance

Step 3 − Again Go to Manage Plugins & Find the GitHub Plugin and choose to install. Restart the Jenkins instance


Step 4 − Go to Configure system

Make sure Maven, Xvfb, Global properties configured properly in jenkins –





Steps to run Selenium  with Jenkins (a sample  web test case) :

Test case is to launch the chrome browser and navigates to  the bimarian web site (

Create Maven project:
Click on “New Item” in Jenkins, give item name as “selenium-web-test” & select “Maven project” then click  OK ,it will navigate to project configuration page


In configuration page – select “Git” in Source Code Management & provide Repository URL -:


Chrome browser  runs on Headless Linux server – so we need Xvfb to display the screen virtually. Xvfb plugin already installed will take care of start/stop Xvfb in build process . Select Start Xvfb before the build, and shut it down after” in Build Environment and click on advanced button then configure properties as shown below: (refer the screenshot)

  • Xvfb specific display name: 99
  • I’m running this job in parallel on same node: select checkbox
  • Timeout in seconds: 0
  • Xvfb screen: 1024x768x8
  • Xvfb display name offset: 1


Configure Build with  properties mentioned below (refer below screenshot)
Root POM: xml
Goals and options: clean test


Save the project

Execute “Build Now” & check the build status