Xvfb on Windows
17,308
Solution 1
You can't use pyvirtualdisplay on Windows.
It is just a wrapper that calls Xvfb. Xvfb is a headless display server for the X Window System. Windows does not use the X Window System.
Solution 2
For windows users you can use the free VNC utility.. For example if you are running docker you can do it in 3 steps:
- Run a docker image that has the standalone firefox server (that has port 5900 exposed for VNC)
$ docker run -d -p 4444:4444 -p 5990:5990 selenium/standalone-firefox-debug
- Open VNC and connect to that host
localhost:5990
, password is 'secret'
- Now simply execute your selenium script and you will see what's happening in VNC window live as its happening. Just make sure the script is pointing to your docker standalone server like
localhost:4444/wd/hub
in order for it to work
Related videos on Youtube
Author by
Ralk
Updated on July 03, 2022Comments
-
Ralk almost 2 years
I'm using pyvirtualdisplay to run a test with a headless Firefox browser. This is the code I'm using :
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from pyvirtualdisplay import Display display= Display(visible=0, size=(320, 240)).start() # visible=0 display.start() driver = webdriver.Firefox() driver.get("https://google.com") display.quit()
And the traceback that I obtain :
easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb','-help']
-
Klaus D. over 7 yearsPossible duplicate of Selenium running headless Firefox browser in Windows
-
-
HenryM almost 7 yearsdo you know of an alternative for Windows?