title: Node JS Click Button on Page
body: <p>I'm trying to make a web-scraper in Node JS and I've hit a roadblock.
  I need to click on a button BUT, if I'm not mistaken, Node doesn't actually render the web-page like a browser would so I can't use a selector or X-Path.</p>
  
  <p>How then, could I click a specific button with the value "yes" if I can't use the selector or X-path? There's no id unique to only the yes button.</p>
  
  <p>I'm asking this because I want to parse a specific web-page but I get redirected to a page that asks me to press two buttons.
  Pressing 'Yes' will bring me to the page I want. Pressing 'No' will obviously stop me from going forward.</p>
  
  <p>Is there any way to do what I want within the confines on Node without having to resort to something like JSDOM?</p>
  
  <p>Here's part of the HTML i'm working with:</p>
  
  <pre><code>&lt;div class="buttons"&gt;
  &lt;button class="c-btn c-btn-primary" type="submit" name="bigbutton" value="no"&gt;no thank you&lt;/button&gt;
  &lt;button class="c-btn c-btn-primary" type="submit" name="bigbutton" value="yes"&gt;continue&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried using something like this:</p>
  
  <pre><code>document.getElementByID("selector").click()
  </code></pre>
  
  <p>but was returned with 'ReferenceError: document is not defined'.</p>