这是我正在尝试做的事情:
var casper = require('casper').create();
casper.start('mysite.html', function() {
});
/* Casper configuration */
casper.on('remote.message', function(msg) {
this.echo('remote message caught: ' + msg);
})
function getAllImages()
{
// Get all images
var images = document.getElementsByTagName('img');
evaluateImages(images);
}
function evaluateImages(images)
{
console.log("I am in evaluateImages");
}
// Then find all pictures
casper.then(function() {
var product_image = this.evaluate(getAllImages);
});
casper.run();
但它永远不会用到 evaluteImages 函数。我在这里想念什么?