code: def close_alert(self, ignore_exception=False):
          
          try:
              alert = self.get_alert()
              alert.accept()
          except:
              if not ignore_exception:
                  raise
docs: JS alerts all blocking. This method closes it. If there is no alert,
          method raises exception. In tests is good to call this method with
          ``ignore_exception`` setted to ``True`` which will ignore any exception.