0

I've been doing some research into headless testing with Robot Framework and I've come across Xvfb. So I installed it with:

pip install robotframework-xvfb

Then in my test case file, I've added:

*** 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

My keywords are all good, no visible errors. Yet when I run the test, it returns the following:

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

Anyone come across this? Thanks in advance!

Mark Booth
  • 7,605
  • 2
  • 68
  • 92
jahn94
  • 3
  • 2

1 Answers1

0

In the 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 module, which does not install xfvb either.

Bear in mind that xfvb is not a Python module but an application that should be installed. Typically this is done by sudo apt-get install xvfb.

A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
  • Thanks for the response. For `sudo apt-get install xvfb` , it won't work on a Mac, so I've tried `pip install xvfb` and `brew install xvfb`, but no progress there either. Do you know the command for Mac? – jahn94 Oct 30 '17 at 09:39
  • Can I ask why you want to use xfvb on MacOS? If it's to run Chrome in a headless mode, there is a chrome startup argument for it which is a lot easier. – A. Kootstra Oct 30 '17 at 13:34
  • Yeah I'd like to run it headless with Chrome. – jahn94 Oct 30 '17 at 16:54
  • This is already possible. In this [SO question](https://stackoverflow.com/a/46817149/6152737) answer replace `Remote` with `Chrome` and remove the `remote_url=...` bit and you'll have a headless running Robot Test. – A. Kootstra Oct 30 '17 at 18:45
  • Good to hear. Can you mark this as the answer for you? – A. Kootstra Oct 31 '17 at 11:37
  • Sure thing, can't seem to select the comment as the answer, only your original post. – jahn94 Oct 31 '17 at 12:09