Skip to content
Advertisement

jenkins cannot run firefox: No protocol specified Error: cannot open display: :0

I have installed jenkins as a service on linux mint. I am trying to run tests written in python and script cannot run firefox. This line is a problem.

… self.browser = webdriver.Firefox() …

When i log in as jenkins user, i can’t run firefox. getting this error :

(process:3758): GLib-CRITICAL **: g_slice_set_config: assertion ‘sys_page_size == 0’ failed No protocol specified No protocol specified Error: cannot open display: :0

Firefox works when i run it from my (logged in) user.

Advertisement

Answer

Just install a virtual framebuffer in your machine and it will work.
Now i’m using Xvfb, but there are many others.
Here is some tutorials to setup your machine:

Also, there is this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Xvfb+Plugin

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement