code: def check_errors(self, expected_error_page=None, allowed_error_pages=[], expected_error_messages=[], allowed_error_messages=[]):
          
          # Close unexpected alerts (it's blocking).
          self.close_alert(ignore_exception=True)
  
          expected_error_pages = set([expected_error_page]) if expected_error_page else set()
          allowed_error_pages = set(allowed_error_pages)
          error_page = self.get_error_page()
          error_pages = set([error_page]) if error_page else set()
          if (
                  error_pages & expected_error_pages != expected_error_pages
                  or
                  error_pages - (expected_error_pages | allowed_error_pages)
          ):
              traceback = self.get_error_traceback()
              raise ErrorPageException(self.current_url, error_page, expected_error_page, allowed_error_pages, traceback)
  
          error_messages = set(self.get_error_messages())
          expected_error_messages = set(expected_error_messages)
          allowed_error_messages = error_messages if allowed_error_messages is ANY else set(allowed_error_messages)
          if (
                  error_messages & expected_error_messages != expected_error_messages
                  or
                  error_messages - (expected_error_messages | allowed_error_messages)
          ):
              raise ErrorMessagesException(self.current_url, error_messages, expected_error_messages, allowed_error_messages)
  
          js_errors = self.get_js_errors()
          if js_errors:
              raise JSErrorsException(self.current_url, js_errors)
docs: This method should be called whenever you need to check if there is some
          error. Normally you need only ``check_expected_errors`` called after each
          test (which you specify only once), but it will check errors only at the
          end of test. When you have big use case and you need to be sure that on
          every step is not any error, use this.
  
          To parameters you should pass same values like to decorators
          :py:func:`.expected_error_page`, :py:func:`.allowed_error_pages`,
          :py:func:`.expected_error_messages` and :py:func:`.allowed_error_messages`.