I am trying to use Casperjs to get a list of links from a page, then open each of those links, and add to an array object a particular type of data from those pages.
If I understand your problem correctly, to solve, give items[] a global scope. In your code, I would have done the following:
var items = [];
this.each(listOfLinks, function(self, link) {
var eachPageHref = link.href;
console.log("Creating new array in object for " + eachPageHref);
object[date][eachPageHref] = []; // array for page to store names
self.thenOpen(eachPageHref, function () {
this.evaluate(function() {
// Perform DOM manipulation to get items
items.push(whateverThisItemIs);
});
});
Hope this helps.