title: How to have multiple evaluate methods run in nightmare.js?
body: <p>I'm using nightmare.js to scrape webpage content. </p>
  
  <p>After authenticating the nightmare instance, I loop through multiple pages (that require a login) and then call the run method that executes all the page loads. </p>
  
  <p>From each page I want to grab specific content so I call the evaluate function which ensures we're executing inside the browser scope. Whatever is returned from the evaluate function becomes the argument in the run method</p>
  
  <p>But I'm trying to run the evaluate function multiple times (once for each page). But the evaluate function can only return output to the run method once. I tried pushing content to a global variable (in the main scope) but can't access it from inside the browser scope. </p>
  
  <p>Can anyone advise on how to have multiple evaluate methods run on one nightmare instance and extract information from each?</p>
  
  <pre><code>var Nightmare = require("nightmare");
  
  //Creates the authenticated nightmare instance
  
  var scraper = new Nightmare()
    .goto('https://www.example.com/signin')
    .type('#login', 'username')
    .type('#password', 'password')
    .click('#btn')
    .run(function(err, nightmare) {
      if (err) {
        console.log(err);
      }
      console.log('Done.');
    });
  
  for (var i = 0; i &lt; 4; i++) {
    scraper
      .goto('https://www.example.com/page'+i)
      .wait(1000)
      .evaluate(function(){
        return $('#result &gt; h3').text()
      })
  }
  
  scraper.run(function(err, result) {
    console.log(result)
    if (err) {
      console.log(err);
    }
  }); )
  </code></pre>