def type_alert(text, action="Accept", timeout=0): r"""Type and close popup alert. Examples -------- .. code-block:: robotframework TypeAlert Qentinel TypeAlert Qentinel Nothing 10s Parameters ---------- text : str Text to type action : str (default = Accept) What is done for popup. Options are: ACCEPT: accept alert DISMISS: dismiss alert NOTHING: don't close alert timeout : str | int How long we wait for text to disappear before failing. Default 10 (seconds) Related keywords ---------------- \`CloseAlert\`, \`IsAlert\`, \`GetAlertText\`, \`VerifyAlertText\` """ alert_ = alert.wait_alert(timeout=timeout) alert.type_alert(alert_, text, timeout=timeout) alert.close_alert(alert_, action)
def is_alert(timeout="0.1s"): r"""Return True/False if alert is found on the screen. Used to get alert presence to variable. This keyword returns after alert is found. Returns True if alert is found. Returns False if alert is not found within timeout. If timeout is not set, keyword returns immediately. Examples -------- .. code-block:: robotframework IsAlert 2s Parameters ---------- timeout : str | int How long we wait for text to disappear before failing. Default 10 (seconds) Related keywords ---------------- \`CloseAlert\`, \`TypeAlert\`, \`GetAlertText\`, \`VerifyAlertText\` """ try: return bool(alert.wait_alert(timeout=timeout)) except QWebDriverError: return False
def close_alert(action, timeout=0): r"""Close popup alert. Examples -------- .. code-block:: robotframework Close Alert Accept 10s Close Alert Dismiss Close Alert Nothing Parameters ---------- action : str What is done for popup. Options are: ACCEPT: accept alert DISMISS: dismiss alert NOTHING: don't close alert timeout : str | int How long we wait for text to disappear before failing. Default 10 (seconds) Related keywords ---------------- \`IsAlert\`, \`TypeAlert\`, \`GetAlertText\`, \`VerifyAlertText\` """ alert_ = alert.wait_alert(timeout=timeout) alert.close_alert(alert_, action)
def get_alert_text(timeout=0): """Get alert text to variable. Examples -------- .. code-block:: robotframework ${TEXT} GetAlertText Parameters ---------- timeout : str | int How long we wait for text to disappear before failing. Default 10 (seconds) """ alert_ = alert.wait_alert(timeout=timeout) return alert_.text
def get_alert_text(timeout=0): r"""Get alert text to variable. Examples -------- .. code-block:: robotframework ${TEXT} GetAlertText Parameters ---------- timeout : str | int How long we wait for text to disappear before failing. Default 10 (seconds) Related keywords ---------------- \`CloseAlert\`, \`IsAlert\`, \`TypeAlert\`, \`VerifyAlertText\` """ alert_ = alert.wait_alert(timeout=timeout) return alert_.text
def verify_alert_text(text, timeout=0): """Verify alert text. Examples -------- .. code-block:: robotframework VerifyAlertText Qentinel Parameters ---------- text : str | int Text to Verify timeout : str | int How long we wait for text to disappear before failing. Default 10 (seconds) """ alert_ = alert.wait_alert(timeout=timeout) if text in alert_.text: return raise QWebValueError('Text {} is not presented in Alert'.format(text))