It is optional to use pyvirtualdisplay as follows:
from pyvirtualdisplay import Display display = Display(visible=0, size=[800, 600]) display.start()
Shorter version:
with Display() as display:
This is usually python encapsulation from xvfb and more convenient.
By the way, although PhantomJS is a PhantomJS browser and the window will not open if you use it, it seems that PhantomJS still needs a gui environment.
I got error code -6 when instead of Firefox() instead of Firefox() I use PhantomJS() in headless mode (console with a loopback connected). However, everything is fine in the desktop environment.
ιζε Jun 29 '17 at 3:29 on 2017-06-29 03:29
source share