title: Clicking on "load more" button via puppeteer
body: <p>I am new to JS. I need to parse comments from Instagram, but first I need to load them all. I am using Puppeteer in Node.js, so I wrote this code:</p>
  
  <pre><code>await page.evaluate(() =&gt; {
      while(document.querySelector('main').querySelector('ul').querySelector('button'))
        document.querySelector('main').querySelector('ul').querySelector('button').click()
    })
  </code></pre>
  
  <p>It does nothing and starts an endless loop. I tried to make a timeout inside the loop and so on...
  I expect that code will check if this button exists and if true - click() on it while it exists loading more and more comments.
  I can't catch what am I doing wrong.</p>