'PhantomJS still have no support for modal dialogs (alert, confirm, prompt) javascript functions.
See comment on `hacks_for_phantomjs()` method above.'

def browser_accept_alert(self, sleep=1, text=None):

    WebDriverWait(self.browser, 30).until(EC.alert_is_present())
    alert = self.browser.switch_to_alert()
    try:
        if (not self.is_phantomjs):
            alert = self.browser.switch_to_alert()
            if text:
                alert.send_keys(text)
            alert.accept()
        if sleep:
            time.sleep(sleep)
    except Exception as exc:
        logging.warn(('==>    Exception    at    browser.browser_set_alert():    %s' % exc))
    return alert
