{"id":5049,"library":"sbvirtualdisplay","title":"sbvirtualdisplay","description":"sbvirtualdisplay (current version 1.4.0) is a Python library that provides a customized virtual display for headless browser automation, primarily designed for use with SeleniumBase. It functions as a wrapper around Xvfb, Xephyr, or Xvnc programs, enabling browser tests to run in environments without a physical display server, which is particularly useful for Linux backend servers. The library is actively maintained with a steady release cadence.","status":"active","version":"1.4.0","language":"en","source_language":"en","source_url":"https://github.com/mdmintz/sbVirtualDisplay","tags":["virtual display","headless","selenium","testing","automation","xvfb","pyvirtualdisplay"],"install":[{"cmd":"pip install sbvirtualdisplay","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"This library is a customized wrapper for pyvirtualdisplay, relying on its core functionality to manage virtual displays.","package":"pyvirtualdisplay"},{"reason":"sbvirtualdisplay (and its base, pyvirtualdisplay) requires an X server like Xvfb (or Xephyr/Xvnc) to be installed on the system to function.","package":"Xvfb","optional":true}],"imports":[{"symbol":"Display","correct":"from sbvirtualdisplay import Display"}],"quickstart":{"code":"from sbvirtualdisplay import Display\n\n# Example usage with context manager (recommended)\nwith Display(visible=0, size=(1440, 1880)):\n    # Code to run browser tests in a headless environment\n    print(\"Virtual display is active, running tests...\")\n    # Example: driver = webdriver.Chrome(options=options)\n    # driver.get(\"http://example.com\")\n    # ...\nprint(\"Virtual display is stopped.\")\n\n# Alternative usage with explicit start/stop\ndisplay = Display(visible=0, size=(1440, 1880))\ntry:\n    display.start()\n    print(\"Virtual display started, running tests...\")\n    # Example: driver = webdriver.Firefox(options=options)\n    # driver.get(\"http://example.com\")\n    # ...\nfinally:\n    display.stop()\n    print(\"Virtual display stopped.\")","lang":"python","description":"Initialize a virtual display with specified visibility and resolution, then execute browser automation code within its context. The context manager ensures the display is properly started and stopped."},"warnings":[{"fix":"Upgrade to Python 3.8 or newer, or pin sbvirtualdisplay to <1.4.0 if Python 3.7 is required.","message":"Support for Python 3.7 was dropped in version 1.4.0. Projects requiring Python 3.7 or older must use an earlier version of sbvirtualdisplay.","severity":"breaking","affected_versions":">=1.4.0"},{"fix":"Upgrade to Python 3.8 or newer. If older Python versions are necessary, use sbvirtualdisplay <1.3.0.","message":"Support for Python 2.7 and Python 3.6 was dropped in version 1.3.0. The minimum supported Python version became 3.7 (and later 3.8 in 1.4.0).","severity":"breaking","affected_versions":">=1.3.0"},{"fix":"Ensure that a compatible X server (like Xvfb) is installed and available on the Linux system where sbvirtualdisplay is used. For macOS/Windows, consider native headless browser modes (e.g., Chrome/Firefox `--headless=new`) or other platform-specific solutions.","message":"This library is primarily designed for Linux environments due to its reliance on the X Window System (via Xvfb, Xephyr, or Xvnc). It is not intended for use on Windows or macOS.","severity":"gotcha","affected_versions":"all"},{"fix":"Install `Xvfb` (or `Xephyr`/`Xvnc`) via your system's package manager (e.g., `sudo apt-get install xvfb` on Ubuntu) before using `sbvirtualdisplay`.","message":"The underlying X server (e.g., Xvfb) must be installed on the system where sbvirtualdisplay runs. This library is a Python wrapper and does not install the X server itself.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}