Sitespeed script: accept javascript alert

Just imagine, you use sitespeed to monitor your website , and your website throws a javascript alert popup – this will usually throw some error. To fix this issue, you can try this script:

module.exports = async function(context, commands) {
  // Measure the page and give it the alias StartPage
  const driver = context.selenium.driver;
   const webdriver = context.selenium.webdriver;
  await commands.measure.start();
  await driver.get('http://www.yoururl.com');
  await driver.switchTo().alert().accept();
   await commands.measure.stop();

};

Leave a Reply

Your email address will not be published. Required fields are marked *