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

2.7k views Asked by At

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.

1

There are 1 answers

1
Victor On BEST 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