Advertisement
Guest User

Untitled

a guest
Sep 17th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var casper = require('casper').create();
  2.  
  3. var limit = 5, count = 1;
  4.  
  5. casper.on('load.finished', function (status) {
  6.     if (status !== 'success') {
  7.         this.echo ("Failed to load page.");
  8.     }
  9.     else {
  10. //        this.echo(this.getHTML());
  11.         this.echo('-------------------------');
  12.     }
  13.  
  14.     this.echo("count: "+count);
  15.     count = count + 1;
  16.     this.echo("count2: "+count);
  17.     if(count > limit) {
  18.         this.echo ("Finished!");
  19.     }
  20.     else {
  21.         var testd = this.evaluate(function(remoteCount) {
  22.             nextPage(remoteCount);
  23.             return remoteCount         
  24.  
  25.         }, count);
  26.         this.echo("testd: "+testd);
  27.     }
  28.  
  29. });
  30.  
  31. casper.start('http://www.example.com').run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement