title: Xvfb + firefox: how to know firefox finishes rendering?
body: <p>I'm trying to grab web thumbnails by using X server to run Firefox in headless (Xvfb) X11. </p>
  
  <p>I am looking for a way to know when Firefox FINISHED rendering and then I can use image programs to grab the windows.</p>
  
  <p><strong>Problem:</strong> I can <strong>NOT</strong> determine when Firefox finishes rendering. All I know is that the status bar should have an output of "Done" once it finishes rendering (IE, as shown in Firefox in GUI).</p>
  
  <p>Can anyone know what can I use to determine whether if Firefox finishes rendering a page or not? </p>
  
  <p>What I did is just sleep 40 seconds but this may not always work.</p>
  
  <p>Environment:
  Centos 5.7, Xvfb, Firefox 3.6.23 </p>
  
  <p>Shell commands:</p>
  
  <pre><code>Xvfb: 1 -screen 0 1024x768x24 &amp;
  
  export DISPLAY=localhost:1.0
  
  DISPLAY=localhost:1.0 firefox http://www.example.com -width 1024 -height 768
  
  sleep 40  **[ NEED some thing to tell me if Firefox finishes rendering ]**
  
  DISPLAY=localhost:1.0 import -window root example.com.png
  
  pkill firefox
  </code></pre>