Selenium – no display specified

I’m not very experienced with X-windows on the Linux platform, so I’m not too skilled in troubleshooting issues with the display. I recently upgraded an Ubuntu system at work to use Ubuntu 9.04 (Jaunty Jackalope), which only has Firefox 3 available (no package for Firefox 2). I had a Selenium server setup running tests, but they stopped working after I upgraded to this newer version of Ubuntu.

I thought that perhaps Selenium wasn’t compatible with version 3 of Firefox, but this isn’t the case. The Selenium website says ‘Firefox 2+’ for browsers running on Linux.

The error I was receiving when I would run a test was:


10:46:19.778 INFO - Preparing Firefox profile...
Error: no display specified

After a bunch of research and Googling online, it turned out I just needed to run this before I started my Selenium server:

export DISPLAY=:0

I hope this saves someone else some time.



13 Responses to Selenium – no display specified
  1. Nigel Horne
    February 25, 2010 | 1:32 pm

    I tried that, but I still get the same error:

    Error: no display specified

  2. Nigel Horne
    February 25, 2010 | 1:44 pm

    Sorry, wrong error message. What I see *after* implementing your suggestion is

    Error: cannot open display: :0

  3. Onlineproxy
    April 7, 2010 | 10:02 am

    hello.
    i ve got the same problem.

    Error: no display specified
    when try to start firefox via selenium.

    seems to be something with $DISPLAY???

  4. kzg
    May 8, 2010 | 4:23 pm

    export DISPLAY=:0
    this saved me a lot of time, thx

  5. Jeevan Pingali
    June 14, 2010 | 9:34 am

    It definitely helped me, thank you

  6. SeanG
    July 20, 2010 | 9:06 pm

    This definitely helped me. Thanks!!

  7. David Miller
    July 30, 2010 | 7:49 am

    Many thanks, spent the best part of a morning not thinking of this :)

  8. tejas
    February 3, 2011 | 3:15 pm

    After adding env variable DISPLAY don’t run firefox as a root.

  9. Sami R.
    February 10, 2011 | 11:51 pm

    Just what I needed, thanks!

  10. goph-R
    February 24, 2011 | 11:36 am

    Thanks man! It is very helpful!

  11. Ansuman
    July 4, 2011 | 8:44 am

    I am facing a different problem.

    when I try to run a code as JUnit test case,

    it gives me a message like this in command prompt.

    11:20:41.382 INFO – Command request: getNewBrowserSession[*firefox, http://www.l
    ogica.com/, ] on session null
    11:20:41.382 INFO – creating new remote session
    11:20:41.384 INFO – Allocated session c3a6b2920e0e42289266f5e132dc0593 for http:
    //www.logica.com/, launching…
    11:20:46.268 INFO – Preparing Firefox profile…

    it stays there forever. does not do anything.
    then I created my own firefox profile, but still the same problem. cant understand whats the problem really !!

    Someone please help. !!!!

    thanks

  12. dom
    October 14, 2011 | 12:11 pm

    awesome! thankyou!, I searched for ages but my search stopped here :D

  13. tojo
    December 19, 2011 | 5:39 pm

    Thanks for posting this, saved me tons of time!

Leave a Reply

Wanting to leave an <em>phasis on your comment?

Trackback URL http://www.redconfetti.com/2010/01/selenium-no-display-specified/trackback/