title: nightmare.js trying to click on link based on anchor text
body: <p>I'm trying to use nightmare, in node js to click on links based on the text inside the anchor text of the link.</p>
  
  <p>Here's some example code:</p>
  
  <pre><code>var Nightmare = require('nightmare');
  var nightmare = Nightmare({show: true})
  
      nightmare
      .goto('https://www.wikipedia.org/')
      .inject('js', 'C:/users/myname/desktop/nodejs/node_modules/jquery/dist/jquery.js')
      .wait(500)
  var selector = 'a';
  nightmare
    .evaluate(function (selector) {
      // now we're executing inside the browser scope.
      return document.querySelector(selector).innerText;
     }, selector) // &lt;-- that's how you pass parameters from Node scope to browser scope
    .end()
    .then(function(result) {
     console.log(result)
    })
  </code></pre>
  
  <p>I'm really unclear on why the inner text of all  tags are not returning? I thought I could maybe do an if statement in the .evalution method, so that it would restrict the link to be clicked on to "English" for instance.</p>
  
  <p>Any idea how to click on links based on the link text?</p>