casperjs模擬登錄-jd無(wú)驗(yàn)證碼簽到-創(chuàng)新互聯(lián)

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();

站在用戶(hù)的角度思考問(wèn)題,與客戶(hù)深入溝通,找到文縣網(wǎng)站設(shè)計(jì)與文縣網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶(hù)體驗(yàn)好的作品,建站類(lèi)型包括:成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名申請(qǐng)網(wǎng)站空間、企業(yè)郵箱。業(yè)務(wù)覆蓋文縣地區(qū)。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。

當(dāng)前題目:casperjs模擬登錄-jd無(wú)驗(yàn)證碼簽到-創(chuàng)新互聯(lián)
地址分享:http://bm7419.com/article46/ggphg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、定制網(wǎng)站網(wǎng)站營(yíng)銷(xiāo)、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)企業(yè)網(wǎng)站制作、網(wǎng)站導(dǎo)航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化