1

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

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.<init>(RemoteWebDriver.java:114)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(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.<init>(RemoteWebDriver.java:114)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(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

Following is my code to get wd instance

    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);

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

1
  • 2
    And is Xvfb really running on display :1 ? e.g. what do you get if you run ps -ef | grep Xvfb on the machine where the tests are supposed to run Commented May 19, 2014 at 18:50

2 Answers 2

1

just try to run it like one process:

xvfb-run -a java -jar your_jar.jar
Sign up to request clarification or add additional context in comments.

Comments

0

I did the mistake of not running xvfb and once I started it as separate process, it started working.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.