【发布时间】:2017-09-08 12:22:30
【问题描述】:
如何在 .then 中使用一些全局变量及其内容?
var casper = require('casper').create();
var globalVariable = "hello world";
casper.start('http://163.172.110.7/be/get.php', function() {
var source = this.getPageContent();
var json = JSON.parse(source);
console.log('step1:', globalVariable);
});
casper.then(function() {
this.echo('step2', globalVariable);
casper.exit();
});
casper.run();
Step1 : 给我“hello world”
第二步:给我“”
我也试过用 casper.globalVariable
【问题讨论】:
标签: casperjs