【问题标题】:Selenium Pyvirtualdisplay Hangs on startingSelenium Pyvirtualdisplay 在启动时挂起
【发布时间】:2014-04-25 06:23:38
【问题描述】:

我有一个硒测试,我试图在我的 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/")

有什么帮助吗?

【问题讨论】:

    标签: python-2.7 selenium headless headless-browser pyvirtualdisplay


    【解决方案1】:

    好的,我终于通过了。

    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

    【讨论】:

      猜你喜欢
      • 2011-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-30
      相关资源
      最近更新 更多