简体   繁体   English

如何在Mac上修复与Xvfb和Selenium相关的'程序安装错误'?

[英]How to fix 'Program install error' related to Xvfb and selenium on a Mac?

I am trying to se a Mac (MacOS 10.13.3) to run selenium tests in an headless environment. 我正在尝试设置Mac(MacOS 10.13.3)在无头环境中运行硒测试。 I am doing basically the following: 我基本上在做以下事情:

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

before invoking the selenium webdriver (selenum 3.8.0). 在调用Selenium Webdriver(Selenum 3.8.0)之前。 However, I get the following error: 但是,出现以下错误:

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

Because it looks like an issue with xvfb I tried to install it: 因为它看起来像xvfb的问题, xvfb我尝试安装它:

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

I also tried the following: 我还尝试了以下方法:

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

What else can I try? 我还能尝试什么?

Addendum: I am not loking for something else. 附录:我不是在寻找别的东西。 I am looking to make the above work on a Mac to develop the tests. 我希望在Mac上进行上述工作以开发测试。 The tests will run in a sane Linux environment (of course not Mac!!) which is perfectly settled to work with xvfb ... 这些测试将在合理的Linux环境(当然不是Mac !!)中运行,这完全适合与xvfb一起xvfb ...

Xvfb is almost certainly not what you want here. Xvfb几乎肯定不是您想要的。

The macOS desktop interface is not based on X11. macOS桌面界面不基于X11。 Xvfb implements a virtual X11 display; Xvfb实现了虚拟的X11显示; it can only be used to run X11 applications -- none of which are installed by default on macOS. 它只能用于运行X11应用程序-在macOS上默认未安装任何应用程序。

macOS does not support headless operation. macOS不支持无头操作。 If you want to run Selenium tests on macOS, you will likely need to run them on your desktop. 如果要在macOS上运行Selenium测试,则可能需要在桌面上运行它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Mac上安装Selenium Python - How to install selenium python on Mac 如何在 Xvfb 中运行 Selenium? - How do I run Selenium in Xvfb? python程序无法正常工作apt-get install xvfb - python program not working apt-get install xvfb 如何在Mac上安装多部分python程序? - How to install a multipart python program on Mac? 如何修复硒中的“模糊”错误? - How to fix 'obscured' error in selenium? 使用 selenium 时,如何在我的程序中修复此错误/问题 - How can I fix this error/issue in my program when using selenium 如何修复与 Python 中的模块相关的错误? - How to fix this Error related to Modules in Python? 如何修复在 mac 上安装 pyinstaller 时出现的错误? - How to fix error in installing pyinstaller on mac? 如何修复mac OS上的mysql django连接? 我已经安装了mysqlclient但是“你安装了mysqlclient吗?”显示错误 - How to fix mysql django connection on mac OS?. I already installed mysqlclient but “Did you install mysqlclient?” Error displayed APNS,当程序在 Mac 上运行时,如何修复树莓派上的“无法获取本地颁发者证书”错误? - APNS, how do I fix “unable to get local issuer certificate” error on raspberry Pi when program works on Mac?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM