I have a script that makes snapshots on a Linux server using Xvfb, Firefox and ImageMagick. The script works fine and is piloted by a bash script, but currently I can obtain only snapshots of 1280x1024, that is the area of Xvfb. I also maximize the FF page, when opening a website, using some Javascript on a dummy page that is loaded first.
Currently Xvfb is launched as follows:
Xvfb :1 -fp /usr/share/X11/fonts/misc -screen 0 1280x1024x24 &
I tried to change the size of virtual screen but with no good results.
What I need to do: My goal is to obtain a snapshot of a full Web page, and therefore have a "taller" height in Xvfb. Can开发者_开发技巧 somebody suggest if Xvfb can be launched, e.g., with a screen area like 1280x8000? Would it work? It seems it does not ...
Thanks in advance
Some solutions from the far future:
- Xvfb supports now the
xrandr
extension, so you can resize your virtual screen as you wish to. For extreme sizes, test it. - Various browsers, including firefox, can print a html page as PDF as their basic functionality.
- Combining with the previous, or using stand-alone: you can also use selenium to manipulate the pages, including render them as PDF or manipulating their DOM.
- Google Chrome has also a headless mode not requiring X at all. Using that is easy, although you lose the visual feedback, what is really going on with your tests.
精彩评论