您好,登錄后才能下訂單哦!
var casper = require('casper').create({ clientScripts:[ 'E:/jquery.js' ] }); var accountLogin = '.login-form .login-tab-r a'; var hidestr = "hide",has_verify = false; casper.start('https://cache.yisu.com/upload/information/20200312/65/243439.jpg"); }); casper.then(function(){ if (this.exists("#ttbar-login")) { this.click("#shortcut-2014 .w .fr #ttbar-login a"); }else{ this.echo("not exists"); } }); casper.then(function(){ this.wait(10000,function() { this.echo("I've waited for 10 seconds again"); }); }); //可刪除 casper.then(function() { this.capture("accountloginui1.jpeg"); }); casper.then(function(){ if (this.exists(accountLogin)) { this.echo("exists"); this.click("#content .login-wrap .w .login-form .login-tab-r a"); }else{ this.echo("not exists"); } }); casper.then(function(){ this.wait(2000,function() { this.echo("I've waited for 2 seconds again"); }); }); //可刪除 casper.then(function() { this.capture("accountloginui2.jpeg"); }); casper.then(function(){ if (this.exists("#o-authcode")) { this.evaluate(function(){ var oauthcode = document.getElementById("o-authcode"); var classValue = oauthcode.className; if (classValue !=null) { if (classValue.indexOf(hidestr) > 0) { has_verify = false; }else{ this.captureSelector("./jdcode.jpeg","#JD_Verification1"); has_verify = true; } } }); } }); casper.then(function(){ this.wait(2000,function() { this.echo("I've waited for 2 seconds again"); }); }); casper.then(function(){ if (has_verify) { this.echo("需要輸入驗(yàn)證碼"); }else{ this.fill('form[id="formlogin"]',{ 'loginname':'xxx', 'nloginpwd':'xxx', },true); } }); casper.then(function(){ this.click(".login-btn a"); this.echo("登錄中..."); }); casper.then(function() { this.wait(10000,function() { this.echo("I've waited for 10 seconds again"); }); }); casper.then(function() { this.echo('new location is ' + this.getCurrentUrl()); this.capture("vipjdcom2.jpeg"); }); casper.then(function() { this.click(".side-shortcut #checkinBtn .icon-set"); }); casper.then(function() { this.wait(2000,function() { this.echo("I've waited for 2 seconds again"); }); }); casper.then(function() { this.capture("vipjdcom3.jpeg"); }); casper.then(function() { this.echo("簽到成功"); }); casper.run();
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。