Skip to main content

xvfbwrapper

Python wrapper for running a display inside X virtual framebuffer (Xvfb)


Install xvfbwrapper from PyPI

pip install xvfbwrapper

System Requirements

  • Xvfb (sudo apt-get install xvfb, or similar)

  • Python 2

About Xvfb (X Virtual Framebuffer)

In the X Window System, Xvfb or X virtual framebuffer is an X11 server that performs all graphical operations in memory, not showing any screen output. This virtual server does not require the computer it is running on to even have a screen or any input device. Only a network layer is necessary.

Example: Basic Usage

from xvfbwrapper import Xvfb

vdisplay = Xvfb()
vdisplay.start()

# launch stuff inside virtual display here

vdisplay.stop()

Example: Headless Selenium WebDriver Tests

#!/usr/bin/env python

from selenium import webdriver
from xvfbwrapper import Xvfb

import unittest


class TestHomepages(unittest.TestCase):

    def setUp(self):
        self.vdisplay = Xvfb(width=1280, height=720)
        self.vdisplay.start()
        self.browser = webdriver.Firefox()

    def testUbuntuHomepage(self):
        self.browser.get('http://www.ubuntu.com')
        self.assertIn('Ubuntu', self.browser.title)

    def testGoogleHomepage(self):
        self.browser.get('http://www.google.com')
        self.assertIn('Google', self.browser.title)

    def tearDown(self):
        self.browser.quit()
        self.vdisplay.stop()


if __name__ == '__main__':
    unittest.main(verbosity=2)

This code uses selenium and xvfbwrapper to run a test with Firefox inside a headless display.

  • install selenium bindings: pip install selenium

  • Firefox will launch inside virtual display (headless)

  • browser is not shown while tests are run

Metadata

Release files for xvfbwrapper 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xvfbwrapper 0.1.1
File Size Uploaded Provenance Actions
xvfbwrapper-0.1.1.tar.gz 2.7 kB Without provenance Details for xvfbwrapper-0.1.1.tar.gz

Release files / xvfbwrapper-0.1.1.tar.gz

Download URL xvfbwrapper-0.1.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7a2e5b5e3d41c66c9621d29af7d9be5ce17e7b6f1ae9b449e1952c6648c2ab4e
BLAKE2b-256 checksum
How to use checksums
9d4a3955524411525b09eabb2e4434bea85a3577cc55915bee74411f6766f92f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for xvfbwrapper 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page