7

나는 내 우분투 서버에서 Headlessly 실행하려고 셀레늄 테스트를했습니다. 그것은 pyvirtualdisplay와 xephyr를 사용합니다. 스크립트는 로컬 시스템에서 잘 실행되지만 서버에서 실행할 때 멈 춥니 다. 메모리를 지우고 서버를 다시 시작하려고했습니다. 그러나 운이 없다. 스크립트는 다음과 같습니다.Selenium Pyvirtualdisplay 시작시 멈춤

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

도움이 필요하십니까?

답변

14

좋아, 마침내 나는 그것을 통과했다. 이렇게

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 

를 해결하려면 :

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 

내가했을 때 그 이후, 가 xvfb-run firefox 다음 나는이 같은 오류를 받기 시작, freetype을 선택

apt-get install dbus-x11