title: How to confirm alert popup with puppeteer
body: <p>I'm clicking on a link that contains a confirm dialog but not being able to dismiss.</p>
  
  <p>I tried to press "Enter" and use puppeteer's method to dismiss &amp; accept the dialog but nothing happened.</p>
  
  <p>The link:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;a onclick="return confirm('Yes?');" id="link" href="google.com"&gt;
  </code></pre>
  
  <p>I tried: </p>
  
  <pre class="lang-js prettyprint-override"><code>page.on('dialog', async dialog =&gt; {
      console.log('here'); //does not pass
      await dialog.accept();
      //await dialog.dismiss();
  });
  </code></pre>
  
  <p>and</p>
  
  <pre class="lang-js prettyprint-override"><code>await page.keyboard.press('Enter');
  await page.keyboard.press(String.fromCharCode(13));
  </code></pre>