7

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/")

何か助けはありますか?

4

1 に答える 1

14

よし、やっと乗り越えた。

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

于 2014-03-19T10:53:43.593 に答える