title: Scrape html from js with node.js and horseman
body: <p>I am trying to scrape the array of batters with salary information from this page:
  <a href="https://www.swishanalytics.com/optimus/mlb/dfs-batter-projections" rel="nofollow">https://www.swishanalytics.com/optimus/mlb/dfs-batter-projections</a></p>
  
  <p>I am using node.js and node-horseman.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>var Horseman = require('node-horseman');
  var horseman = new Horseman();
  
  horseman.open('https://www.swishanalytics.com/optimus/mlb/dfs-batter-projections');
  
  if (horseman.status() === 200) {
      console.log('[+] Successful page opening')
      horseman.screenshot('image.png');
      console.log(horseman.html());
    }    
  horseman.close();
  </code></pre>
  
  <p>The issue is the return from horseman.html() is still a lot of JavaScript and cannot be extracted with something like cheerio. How can I execute the javascript programatically?</p>
  
  <p>For example, if I view source at the same link I see that the area that has the batters starts with     </p>
  
  <pre><code>function Model(){ this.batterArray = 
  [{"team_short":"rockies","mlbam_id":"571448","player_name":"Nolan Arenado",
  </code></pre>
  
  <p>Obviously this is still javascript... I'm assuming that at some point it must be executed and converted to HTML to be presented by a browser? </p>