How to setup headless firefox browser Ubuntu Server

15.2k Views Asked by At

I am trying to setup a headless firefox browser for my Ubuntu Server. I followed instructions on other posts but nothing seems to be working. I get this error when trying to startup firefox.

~(branch:master*) » firefox                                                                                                                                                                     jake@ubuntu
Error: no display specified
------------------------------------------------------------
~(branch:master*) » phpunit functional/SiteTest.php                                                                                                                                             jake@ubuntu
------------------------------------------------------------
~(branch:master*) » export DISPLAY=:10                                                                                                                                                          jake@ubuntu
------------------------------------------------------------
~(branch:master*) » firefox                                                                                                                                                                     jake@ubuntu
Error: cannot open display: :10

I am thinking it must be something with the display driver.

These are the instructions I am following.

http://www.installationpage.com/selenium/how-to-run-selenium-headless-firefox-in-ubuntu/

Let me know if you need more details.

2

There are 2 best solutions below

0
warvariuc On

Install xvfb package:

sudo apt-get install xvfb

Then run firefox like this:

xvfb-run firefox
0
Matthias Bloch On

on a fresh Ubuntu 16.04.1, I installed firefox. This did not work with

Couldn't open libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory

I installdfed xvfb

sudo apt-get install xvfb

and started firefox

firefox

This worked. Be aware to ssh login with -X

ssh -X user@your_headless_box

and have something on your host that can display X applications. On Windows that would probably be Xming, on Mac XQuartz