【问题标题】:How to fix 'Program install error' related to Xvfb and selenium on a Mac?如何在 Mac 上修复与 Xvfb 和 selenium 相关的“程序安装错误”?
【发布时间】:2018-02-02 07:01:53
【问题描述】:

我正在尝试使用 Mac (MacOS 10.13.3) 在无头环境中运行 selenium 测试。我基本上在做以下事情:

from pyvirtualdisplay impot Display
display = Display(visible=0, size=(13660, 7680))
display.start()

在调用 selenium webdriver (selenum 3.8.0) 之前。但是,我收到以下错误:

self = <EasyProcess cmd_param=['Xvfb', '-help'] cmd=['Xvfb', '-help'] oserror=[Errno ... directory return_code=None stdout="None" stderr="None" timeout_happened=False>

    def check_installed(self):
        """Used for testing if program is installed.

            Run command with arguments. Wait for command to complete.
            If OSError raised, then raise :class:`EasyProcessCheckInstalledError`
            with information about program installation

            :param return_code: int, expected return code
            :rtype: self

            """
        try:
            self.call()
        except Exception:
>           raise EasyProcessCheckInstalledError(self)
E           EasyProcessCheckInstalledError: cmd=['Xvfb', '-help']
E           OSError=[Errno 2] No such file or directory
E           Program install error!

venv_pytest/lib/python2.7/site-packages/easyprocess/__init__.py:180: EasyProcessCheckInstalledError

因为xvfb 看起来有问题,所以我尝试安装它:

>pip install xvfb
Collecting xvfb
  Could not find a version that satisfies the requirement xvfb (from versions: )
No matching distribution found for xvfb

我还尝试了以下方法:

>brew install xvfb
Error: No available formula with the name "xvfb" 

我还能尝试什么?

附录:我不是在寻找其他东西。我希望在 Mac 上进行上述工作以开发测试。测试将在健全的 Linux 环境(当然不是 Mac !!)中运行,该环境非常适合与 xvfb...

【问题讨论】:

标签: python macos selenium xvfb


【解决方案1】:

Xvfb 几乎肯定不是你想要的。

macOS 桌面界面不是基于 X11。 xvfb 实现了一个虚拟的 X11 显示;它只能用于运行 X11 应用程序——macOS 上默认没有安装这些应用程序。

macOS 不支持无头操作。如果您想在 macOS 上运行 Selenium 测试,您可能需要在桌面上运行它们。

【讨论】:

  • 这意味着我无法在 Mac 上开发测试并无头检查它们。对吗?
猜你喜欢
  • 2017-11-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-17
  • 1970-01-01
  • 1970-01-01
  • 2016-04-26
  • 1970-01-01
相关资源
最近更新 更多