var casper = require('casper').create({
viewportSize:{
width:1920,
height:1080
}
});
var url1 = 'http://jifen.yuyid.com';
var url2 = 'https://www.yuyid.com';
casper.start();
casper.thenOpen(url1,function(){
console.log('==========已打开积分商城首页=========');
this.captureSelector('jifen.png','html');
this.wait(1000); //this.wait方法挡不住当前回调函数下面代码的执行,只能延时下一步要执行的代码,比如下面这个casper.then
this.click('div.go-login');
this.echo('thenopen');
})
casper.then(function(){
//等待1s后执行这个回调
console.log('then');
this.captureSelector('alert.jpg','html')
})
casper.run();