{"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":"python","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,"search_vec":"'1.4.0':5 'activ':60 'around':31 'autom':19,72 'backend':55 'browser':18,38 'cadenc':66 'current':3 'custom':13 'design':21 'display':15,47,68 'enabl':37 'environ':43 'function':27 'headless':17,69 'librari':9,58 'linux':54 'maintain':61 'particular':51 'physic':46 'primarili':20 'program':36 'provid':11 'python':8 'pyvirtualdisplay':74 'releas':65 'run':41 'sbvirtualdisplay':1,2 'selenium':70 'seleniumbas':25 'server':48,56 'steadi':64 'test':39,71 'use':23,52 'version':4 'virtual':14,67 'without':44 'wrapper':30 'xephyr':33 'xvfb':32,73 'xvnc':35","created_at":"2026-04-12T16:51:53.033426+00:00","updated_at":"2026-04-16T21:22:19.792083+00:00","problems":[{"fix":"Install Xvfb using your system's package manager. For Debian/Ubuntu: `sudo apt-get install xvfb`. For CentOS/RHEL: `sudo yum install xorg-x11-server-Xvfb`.","cause":"The underlying Xvfb display server program, which sbvirtualdisplay uses as a backend, is not installed or not found in your system's PATH.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'Xvfb'"},{"fix":"Ensure all previous virtual display processes are terminated. If manually specifying `os_display_number`, try removing it to let sbvirtualdisplay find a free display, or choose a higher, unused number (e.g., `display = Display(visible=0, os_display_number=100)`).","cause":"The virtual display server (e.g., Xvfb) failed to launch. This often happens because the specified display number is already in use, or there are other environmental issues preventing the X server from starting.","error":"pyvirtualdisplay.abstractdisplay.XStartError: X server did not start."},{"fix":"Use one of the supported backend names: `'xvfb'`, `'xephyr'`, or `'xvnc'`. For example, `Display(backend='xvfb', ...)`. Ensure the chosen backend's executable is also installed on your system.","cause":"The specified `backend` for the virtual display is not recognized or supported by sbvirtualdisplay. Valid backends are typically `'xvfb'`, `'xephyr'`, or `'xvnc'`.","error":"ValueError: Invalid backend '...' (e.g., 'nonexistent')"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.4.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/mdmintz/sbVirtualDisplay","docs":null,"changelog":"https://github.com/mdmintz/sbVirtualDisplay/releases","pypi":"https://pypi.org/project/sbvirtualdisplay/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}