title: Casperjs - is there a way to wait for n seconds?
body: <p>Just to clarify, I don't want to wait for a condition, simply pause for n seconds. This is the code I have, but id does not work the way I expected it, my suspicion is that "wait" is asynchronous. I want to have the code changed, so that it prints 1, waits for 5 seconds, prints 2, then prints 3. Right now it prints 1, prints 3, then waits for 5 seconds and prints 2.</p>
  
  <pre><code>var casper = require('casper').create();
  
  var x = require('casper').selectXPath;
  var fs = require('fs');
  var parsedFile = "pfile.txt";
  
  casper.start();
  
  function wait5seconds() {
     casper.wait(5000, function() {
          this.echo('2');
     });
  }
  
  casper.then(function() {
    this.echo('1');
    wait5seconds();  
    this.echo('3');
  });
  
  casper.run();
  </code></pre>