title: Headless webdriver tests. Unable to use xvfb in java
body: <p>I am trying to run headless webdriver tests in java. When I try to run the webdriver test using :1 display, it gives me error</p>
  
  <pre><code>org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
  
  (process:30300): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
  Error: cannot open display: :1
  
  
  (process:30308): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
  Error: cannot open display: :1
  
      at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
      at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
      at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:114)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:193)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:186)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:182)
      at timnow.main(timnow.java:25)
  Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7055; process output follows: 
  
  (process:30300): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
  Error: cannot open display: :1
  
  (process:30308): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
  Error: cannot open display: :1
  
  Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
  System info: host: 'santhu-personal', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.8.0-35-generic', java.version: '1.7.0_51'
  Driver info: driver.version: FirefoxDriver
      at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130)
      at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
      at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:114)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:193)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:186)
      at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:182)
      at timnow.main(timnow.java:25)
  Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
  
  (process:30300): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
  Error: cannot open display: :1
  
  (process:30308): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
  Error: cannot open display: :1
  
      at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
      ... 6 more
  </code></pre>
  
  <p>Following is my code to get wd instance</p>
  
  <pre><code>    String Xport = System.getProperty("lmportal.xvfb.id", ":1");
      System.out.println(Xport);
      final File firefoxPath = new File(System.getProperty("lmportal.deploy.firefox.path", 
          "/usr/bin/firefox"));
      FirefoxBinary firefoxBinary = new FirefoxBinary(firefoxPath);
      firefoxBinary.setEnvironmentProperty("DISPLAY", Xport);
  
      FirefoxDriver wd;
      wd = new FirefoxDriver(firefoxBinary, null);
  </code></pre>
  
  <p>I am able to run the tests with out xvfb though. I did some research regarding the problem. Some people seemed to have solved the issue with upgrading webdriver but I am using latest webdriver jars ie 2.41.0 with firefox version 26.0 </p>