I'm using Amazon Linux. I want to run a headless chromium browser to use on my node.js Selnium tests. So I fire up my Xvfb server like so ...
if ! pidof /usr/bin/Xvfb; then Xvfb :0 -screen 5 1024x768x8 & fi
However, when I try and take a screenshot after my tests have failed,
DISPLAY=:0 import -window root /tmp/screenshot.png
I get the error mentioned below...
+ DISPLAY=:0
+ import -window root /tmp/screenshot.png
import: unable to open X server `:0' @ error/import.c/ImportImageCommand/369.
How do I take a screenshot of Xvfb buffer?
xwd
andxwud
instead ofimage
, works here, too. Maybe check again whether Xvfb is still running, and running on :0?xwd -display :0 -root -out /tmp/pic
takes a snapshot, andxwud -in /tmp/pic
shows it.