【发布时间】: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...
【问题讨论】:
-
抱歉。我不能尝试别的东西。我想让上面的代码工作。有了
xvfb。除非它在 Mac 上根本不可能......
标签: python macos selenium xvfb