title: Wait for some time in PhantomJS between console logs in the page context
body: <p>I need to wait some time in PhantomJS. I searched a lot but didn't find an answer. I try this code inside <code>page.open</code> but it doesn't work.</p>
  
  <pre><code>var interval = window.setInterval(function(){ 
      console.log("works");
      clearInterval(interval); 
  }, 3000);
  </code></pre>
  
  <p>I also tried <code>setTimeout</code> but it also didn't help</p>
  
  <pre><code>window.setTimeout(function(){ 
      console.log("works");
  }, 3000);
  </code></pre>
  
  <p>What is a solution for waiting some seconds?</p>
  
  <p>I need to wait 3 seconds between logs: <code>jquery included</code> and <code>works</code>. But these logs appear in console simultaneously.</p>
  
  <pre><code>var page = require("webpage").create();
  var url = "https://www.youtube.com";
  
  page.open(url, function(status) {
      if (status == "success"){
          console.log(status);
          if (page.injectJs("jquery.min.js")){
              console.log("jquery included");
              page.evaluate(function(){
                  setTimeout(function(){       
                  }, 3000);
              });
              console.log("works");
              phantom.exit();
          }       
      }
      else{
          console.log(status);
          phantom.exit();
      }
  });
  </code></pre>