1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| var casper = require('casper').create(); var conf = { 'baixing' : { login : 'http://www.baixing.com/oz/login', user : '', pwd : '', list : 'http://www.baixing.com/w/posts?src=topmenu', fresh : [ 'http://www.baixing.com/pays/refresh/?adId=258292835', ] }, '99cfw' : { login : 'http://user.99cfw.com/login/', user : '', pwd : '', fresh : [ 'http://user.99cfw.com/refresh.asp?id=zryxyzfurxswu', 'http://user.99cfw.com/refresh.asp?id=zrztuRuvrxswu', ] } };
casper.start(conf['99cfw'].login, function () { this.fill('form#userlogin', { 'loginName' : conf['99cfw'].user, 'password' : parseInt(conf['99cfw'].pwd, 16) }, true); });
casper.thenEvaluate(function () { document.querySelector('button[type="submit"]').submit(); });
casper.wait(500);
casper.each(conf['99cfw'].fresh, function (self, link) { self.thenOpen(link, function () { this.echo(link); }); });
casper.wait(500);
casper.then(function () { this.echo('99cfw Done!'); });
casper.thenOpen(conf['baixing'].login, function () { this.fill('form#authform', { 'identity' : conf['baixing'].user, 'password' : parseInt(conf['baixing'].pwd, 16) }, true); });
casper.thenEvaluate(function () { document.querySelector('#id_submit').click(); });
casper.wait(200);
casper.thenOpen(conf['baixing'].fresh[0]);
casper.then(function () { this.echo('baixing Done!') this.capture('step2.png'); });
casper.run();
|