'Verifies an alert is present and dismisses it.
If `text` is a non-empty string, then it is also verified that the
message of the alert equals to `text`.
Will fail if no alert is present. Note that following keywords
will fail unless the alert is dismissed by this
keyword or another like `Get Alert Message`.'

@keyword
def alert_should_be_present(self, text=''):

    alert_text = self._handle_alert(self.ACCEPT_ALERT)
    if (text and (alert_text != text)):
        raise AssertionError(("Alert    text    should    have    been    '%s'    but    was    '%s'" % (text, alert_text)))
