@after.each_scenario
def clear_alerts(_scenario):
 try:
  with world.browser.get_alert() as alert:
   alert.dismiss()
 except NoAlertPresentException:
  pass

@ after . each_scenario def clear_alerts ( _scenario ) : try : with world . browser . get_alert ( ) as alert : alert . dismiss ( ) except NoAlertPresentException : pass
clear any alerts that might still exist .