casperjs模拟登录-jd无验证码登录-创新互联
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('/file/tupian/20230130/404.html");
});
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("需要输入验证码");
}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("jd.jpeg");
});
casper.run();创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。

名称栏目:casperjs模拟登录-jd无验证码登录-创新互联
地址分享:http://jxruijie.cn/article/csgoes.html
