Answer the question
In order to leave comments, you need to log in
Casperjs function each returns only the last element?
var casper = require('casper').create({
pageSettings: {
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11"
}
});
var links = [
"http://google.com/",
"http://bing.com/",
"http://yahoo.com/",
];
casper.start();
casper.each(links, function (self, link) {
self.thenOpen(link, function () {
this.echo(this.getTitle() + " - " + link);
});
});
casper.run();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question