async function dismissJavaScriptDialogs(session) {
  session.on('Page.javascriptDialogOpening', data => {
    log.warn('Driver', `${data.type} dialog opened by the page automatically suppressed.`);

    session
      .sendCommand('Page.handleJavaScriptDialog', {
        accept: true,
        promptText: 'Lighthouse prompt response',
      })
      .catch(err => log.warn('Driver', err));
  });

  await session.sendCommand('Page.enable');
}
Dismiss JavaScript dialogs (alert, confirm, prompt), providing a
generic promptText in case the dialog is a prompt.
@param {LH.Gatherer.ProtocolSession} session
@return {Promise<void>}