找不到名称为 'Start Virtual Display' 的关键字

No keyword with name 'Start Virtual Display' found

我一直在研究使用 Robot Framework 进行无头测试,并且遇到了 Xvfb。所以我安装了它:

pip 安装 robotframework-xvfb

然后在我的测试用例文件中,我添加了:

*** Settings ***
Library  Selenium2Library
Library  XvfbRobot

*** Test Cases ***
Creating a headless browser
    [Tags]  Headless
    Starting your display
    The user goes to the website
    Maximizing the window
    The user enters an incorrect email
    The user sees they have entered an incorrect email

我的关键字都很好,没有明显的错误。然而,当我 运行 测试时,它 returns 以下内容:

Importing test library 'XvfbRobot' failed: ImportError: No module named xvfbwrapper
Traceback (most recent call last):
  File "/usr/local/Cellar/robot-framework/3.0.2_1/libexec/lib/python2.7/site-packages/XvfbRobot/__init__.py", line 19, in <module>
    from xvfbwrapper import Xvfb

有人遇到过这个吗?提前致谢!

robotframework-xfvb library requirements list it clearly states that xfvb should be manually installed. This is confirmed from the installation scripts of robotframework-xfvb and that of xfvbwrapper模块中,也没有安装xfvb。

请记住,xfvb 不是 Python 模块,而是应该安装的应用程序。通常这是由 sudo apt-get install xvfb.

完成的