我有一个selenium测试,我正试图在我的ubuntu服务器上运行它。它使用pyvirtualdisplay和xephyr。尽管该脚本在我的本地系统中运行良好,但当我在服务器中运行它时,它会挂起。我已尝试清除内存并重新启动服务器。但没那么走运。该脚本如下所示:
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/")有什么帮助吗?
发布于 2014-03-19 18:53:44
好了,我终于挺过来了。
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选择了freetype,在那之后,当我执行xvfb-run firefox时,我开始收到这样的错误:
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要解决此问题,请执行以下操作:
apt-get install dbus-x11
https://stackoverflow.com/questions/22498551
复制相似问题