Skip to content

Instantly share code, notes, and snippets.

@vilkoz
Last active July 10, 2020 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vilkoz/3a3599e5f069945599a60533717d4357 to your computer and use it in GitHub Desktop.
Save vilkoz/3a3599e5f069945599a60533717d4357 to your computer and use it in GitHub Desktop.
Inspecting contents of window inside Xvfb for xvfbwrapper python module

Add fbdir option to Xvfb object:

vdisplay = Xvfb(width=1920, height=1080, colordepth=24, fbdir="/tmp/")

This option will tell xfvb to save dumps of its contents to PROVIDED_FOLDER/Xvfb_screen<n>

The dump file will be in .xwd format, so it needs to be converted to some format supported by image viewers. For the convenience you can use the following script:

#!/bin/bash
for i in $(seq 10000); do
  /bin/cp  Xvfb_screen? Xvfb_screen.xwd;
  convert /tmp/Xvfb_screen.xwd screen_image_$i.png;
  sleep 1;
done

Adjust the value in sleep depending on what fps you want to get, e.g. for 60 fps use 0.016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment