Selenium Pyvirtualdisplay Hangs On Start

I have a selenium test that I am trying to run headless on my ubuntu server. It uses pyvirtualdisplay and xephyr. Although the script runs fine on my local system, it freezes when I run it on the server. I tried to clear the memory and restart the server. But no luck. The script looks something like this:

from selenium import webdriver from pyvirtualdisplay import Display display = Display(visible=0, size=(1366, 768)) display.start() driver = webdriver.Firefox() driver.set_window_size(1366, 768) driver.get ("http://www.google.com/") 

Any help?

+7
selenium headless-browser headless pyvirtualdisplay
source share
1 answer

Well, finally, I went through this.

 sudo apt-get install xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic sudo apt-get -y install x-ttcidfont-conf cabextract ttf-mscorefonts-installer sudo apt-get -y install x-ttcidfont-conf sudo dpkg-reconfigure x-ttcidfont-conf 

I chose freetype , after that, when I did xvfb-run firefox I started getting errors like this:

 Xlib: extension "RANDR" missing on display ":99". (firefox:4691): GConf-WARNING **: Client failed to connect to the D-BUS daemon: //bin/dbus-launch terminated abnormally without any error message (firefox:4691): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Error spawning command line `dbus-launch --autolaunch=c4970e12ff5496da09501f87000001fe --binary-syntax --close-stderr': Failed to execute child process "dbus-launch" (No such file or directory) (firefox:4691): GConf-WARNING **: Client failed to connect to the D-BUS daemon: //bin/dbus-launch terminated abnormally without any error message 

To solve, do the following:

apt-get install dbus-x11

+14
source share

All Articles