I'm getting the following error when I try to open the Firefox in headless mode:
Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port
7055; process output follows:
(process:27527): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
Xlib: extension "RANDR" missing on display ":1".
(firefox:27527): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-VBJDTHN8W2: Connection refused
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'
System info: host: 'cpro22808', ip: '176.153.5.11', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-32-generic', java.version:
'1.7.0_55'
Driver info: driver.version: FirefoxDriver
I'm using Ubuntu 14.04, Firefox 33, Selenium 2.44, Tomcat7, Xvfb.
I'm starting the Xvfb like that:
Xvfb :1 -ac -screen 0 1024x768x24
My java code:
String Xport = System.getProperty("lmportal.xvfb.id", ":1");
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.setEnvironmentProperty("DISPLAY", Xport);
webDriver = new FirefoxDriver(firefoxBinary, null);
I spent several days on this and tried a lot of things and nothing solve. Can someone help me?
I was also facing the same problem. This is what I did and the problem is gone.
/var/lib/dbus/machine-id
. It will recreate a correct one on its one. export $(dbus-launch)
and export NSS_USE_SHARED_DB=ENABLED
. Set these environment variables and then re-run. The issue was gone in my case.
That's a good solution but at the end I discovered another option without the need of launching dbus. You can instead disable the logging of geckodriver with -Dwebdriver.firefox.logfile=/dev/null
system property.
Curiously I could pass it from command line, but I had to explicitly set it before instantiating the FirefoxDriver:
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/dev/null");
FirefoxDriver driver = new FirefoxDriver(firefoxOptions);
The drawback is that you lose also any other log, but I like the fact that you don't need to run dbus-daemon.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.