title: Selenium Webdriver - Issue with FirefoxDriver on Debian Lenny (Error No display)
body: <p>I am using Selenium to test my website, it opens up a URL using Firefox, logins and does some stuff on the page and then logs out and shuts firefox. That all works great on Windows 7. The code starts with:</p>
  
  <pre><code>WebDriver driver = new FirefoxDriver();
  driver.get(URL);
  </code></pre>
  
  <p>Now I deployed my jar in  linux box that runs Debian lenny which has iceweasel on it. A cron job starts the program which throws the following error when trying to open firefox:</p>
  
  <blockquote>
    <p>org.openqa.selenium.firefox.NotConnectedException: Unable to connect
    to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
    Error: cannot open display: :0 Error: cannot open display: :0</p>
    
    <p>at
    org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:106)
      at
    org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
      at
    org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:183)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:179)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:92)
      at auth.Authenticator.authenticate(Authenticator.java:15)   at
    reader.ReaderThread.run(ReaderThread.java:67)
    org.openqa.selenium.WebDriverException: Failed to connect to binary
    FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: 
    Error: cannot open display: :0 Error: cannot open display: :0</p>
    
    <p>Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
    System info: os.name: 'Linux', os.arch: 'i386', os.version:
    '2.6.26-2-686', java.version: '1.6.0_26' Driver info: driver.version:
    FirefoxDriver at
    org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
      at
    org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
      at
    org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:110)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:190)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:183)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:179)
      at
    org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:92)
      at auth.Authenticator.authenticate(Authenticator.java:15)   at
    reader.ReaderThread.run(ReaderThread.java:67)</p>
  </blockquote>
  
  <p>I have Xvfb running ok in the box and I have set variable DISPLAY to 0. I have searched around and none of the solutions (like setting the env variable) worked.</p>
  
  <p>Isnt XVfb supposed to work as a non-graphical environment that the browser will launch into and do the necessary actions? What's stopping it from starting up?</p>
  
  <p>I am using the latest Selenium version 2.31 and Firefox 3.0.6 Iceweasel. </p>
  
  <p><strong>Edit:</strong> Updated to Firefox 14 and still see the same issue. I even raised the timeout limit to 60 seconds.</p>
  
  <p>driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);</p>
  
  <p><strong>SOLVED:</strong> By running it with the xvfb wrapper, xvfb-run like this:</p>
  
  <pre><code>export DISPLAY=:0.0
  xvfb-run --auto-servernum --server-num=0 nohup java - jar X.jar
  </code></pre>