【问题标题】:pyvirtualdisplay on Amazon EC2 instanceAmazon EC2 实例上的 pyvirtualdisplay
【发布时间】:2015-03-10 02:24:29
【问题描述】:

我正在尝试在 Amazon EC2 上运行 selenium。我使用 pyvirtualdisplay 作为 xvfb 包装器。我在 python 中运行了以下命令。

from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(1024, 768))
display.start()

到目前为止一切都很好。
但是当我这样做时:

driver = webdriver.Firefox()

我收到此错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-   packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
self.binary, timeout),
File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/extension_connection.py", line 47, in  __init__
self.binary.launch_browser(self.profile)
File "/usr/lib/python2.6/site-packages/selenium/webdriver/firefox/firefox_binary.py", line 66, in launch_browser
self._wait_until_connectable()
File "/usr/lib/python2.6/site- packages/selenium/webdriver/firefox/firefox_binary.py", line 100, in _wait_until_connectable
raise WebDriverException("The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser   appears to have exited before we could connect. If you specified a    log_file in the FirefoxBinary constructor, check it for details.

【问题讨论】:

    标签: python selenium amazon-ec2 xvfb pyvirtualdisplay


    【解决方案1】:

    在互联网上花了很多时间寻找解决方案并尝试了所有可能的事情之后,对我有用的一件事就是这个。
    https://superuser.com/questions/870702/aws-ec2-linux-headless-firefox-issue-xvfb-undefined-symbol-pixman-glyph-cache

    正如答案所说:
    它正在尝试加载 wring pixman。删除 /usr/local/lib/libpixman-1.so.0 再试一次,Xvfb 会使用带有这个符号的发行版 pixman 库。

    【讨论】:

      猜你喜欢
      • 2016-11-28
      • 1970-01-01
      • 1970-01-01
      • 2015-04-04
      • 1970-01-01
      • 2013-03-28
      • 2013-10-27
      • 2016-05-31
      • 2015-06-02
      相关资源
      最近更新 更多