Robot Framework SeleniumLibrary
SeleniumLibrary.keywords.alert.AlertKeywords Class Reference
Inheritance diagram for SeleniumLibrary.keywords.alert.AlertKeywords:
SeleniumLibrary.base.librarycomponent.LibraryComponent SeleniumLibrary.base.context.ContextAware

Public Member Functions

def alert_should_be_present (self, text='', action=ACCEPT, timeout=None)
 Verifies that an alert is present and, by default, accepts it. More...
 
def alert_should_not_be_present (self, action=ACCEPT, timeout=0)
 Verifies that no alert is present. More...
 
def handle_alert (self, action=ACCEPT, timeout=None)
 Handles the current alert and returns its message. More...
 
def input_text_into_alert (self, text, action=ACCEPT, timeout=None)
 Types the given text into an input field in an alert. More...
 
- Public Member Functions inherited from SeleniumLibrary.base.librarycomponent.LibraryComponent
def assert_page_contains (self, locator, tag=None, message=None, loglevel='TRACE')
 
def assert_page_not_contains (self, locator, tag=None, message=None, loglevel='TRACE')
 
def debug (self, msg, html=False)
 
def get_timeout (self, timeout=None)
 
def info (self, msg, html=False)
 
def log (self, msg, level='INFO', html=False)
 
def log_source (self, loglevel='INFO')
 
def warn (self, msg, html=False)
 
- Public Member Functions inherited from SeleniumLibrary.base.context.ContextAware
def __init__ (self, ctx)
 Base class exposing attributes from the common context. More...
 
def find_element (self, locator, tag=None, required=True, parent=None)
 Find element matching locator. More...
 
def find_elements (self, locator, tag=None, parent=None)
 Find all elements matching locator. More...
 
def is_element_enabled (self, locator, tag=None)
 
def is_text_present (self, text)
 
def is_visible (self, locator)
 

Static Public Attributes

string ACCEPT = 'ACCEPT'
 
string DISMISS = 'DISMISS'
 
string LEAVE = 'LEAVE'
 

Private Member Functions

def _handle_alert (self, alert, action)
 
def _wait_alert (self, timeout=None)
 

Static Private Attributes

string _next_alert_action
 

Additional Inherited Members

- Public Attributes inherited from SeleniumLibrary.base.context.ContextAware
 ctx
 
- Properties inherited from SeleniumLibrary.base.librarycomponent.LibraryComponent
 log_dir = property
 
- Properties inherited from SeleniumLibrary.base.context.ContextAware
 driver = property
 
 drivers = property
 
 element_finder = property
 

Detailed Description

Definition at line 25 of file alert.py.

Member Function Documentation

◆ _handle_alert()

def SeleniumLibrary.keywords.alert.AlertKeywords._handle_alert (   self,
  alert,
  action 
)
private

Definition at line 123 of file alert.py.

◆ _wait_alert()

def SeleniumLibrary.keywords.alert.AlertKeywords._wait_alert (   self,
  timeout = None 
)
private

Definition at line 134 of file alert.py.

◆ alert_should_be_present()

def SeleniumLibrary.keywords.alert.AlertKeywords.alert_should_be_present (   self,
  text = '',
  action = ACCEPT,
  timeout = None 
)

Verifies that an alert is present and, by default, accepts it.

    Fails if no alert is present. If ``text`` is a non-empty string,
    then it is used to verify alert's message. The alert is accepted
    by default, but that behavior can be controlled by using the
    ``action`` argument same way as with `Handle Alert`.

    ``timeout`` specifies how long to wait for the alert to appear.
    If it is not given, the global default `timeout` is used instead.

    ``action`` and ``timeout`` arguments are new in SeleniumLibrary 3.0.
    In earlier versions the alert was always accepted and timeout was
    hard coded to one second.

Definition at line 65 of file alert.py.

◆ alert_should_not_be_present()

def SeleniumLibrary.keywords.alert.AlertKeywords.alert_should_not_be_present (   self,
  action = ACCEPT,
  timeout = 0 
)

Verifies that no alert is present.

    If the alert actually exists, the ``action`` argument determines
    how it should be handled. By default the alert is accepted, but
    it can be also dismissed or left open the same way as with the
    `Handle Alert` keyword.

    ``timeout`` specifies how long to wait for the alert to appear.
    By default the alert is not waited at all, but a custom time can
    be given if alert may be delayed. See the `time format` section
    for information about the syntax.

    New in SeleniumLibrary 3.0.

Definition at line 86 of file alert.py.

◆ handle_alert()

def SeleniumLibrary.keywords.alert.AlertKeywords.handle_alert (   self,
  action = ACCEPT,
  timeout = None 
)

Handles the current alert and returns its message.

    By default the alert is accepted, but this can be controlled
    with the ``action`` argument that supports the following
    case-insensitive values:

    - ``ACCEPT``: Accept the alert i.e. press ``Ok``. Default.
    - ``DISMISS``: Dismiss the alert i.e. press ``Cancel``.
    - ``LEAVE``: Leave the alert open.

    The ``timeout`` argument specifies how long to wait for the alert
    to appear. If it is not given, the global default `timeout` is used
    instead.

    Examples:
    | Handle Alert |                |       | # Accept alert.  |
    | Handle Alert | action=DISMISS |       | # Dismiss alert. |
    | Handle Alert | timeout=10 s   |       | # Use custom timeout and accept alert.  |
    | Handle Alert | DISMISS        | 1 min | # Use custom timeout and dismiss alert. |
    | ${message} = | Handle Alert   |       | # Accept alert and get its message.     |
    | ${message} = | Handle Alert   | LEAVE | # Leave alert open and get its message. |

    New in SeleniumLibrary 3.0.

Definition at line 119 of file alert.py.

◆ input_text_into_alert()

def SeleniumLibrary.keywords.alert.AlertKeywords.input_text_into_alert (   self,
  text,
  action = ACCEPT,
  timeout = None 
)

Types the given text into an input field in an alert.

    The alert is accepted by default, but that behavior can be controlled
    by using the ``action`` argument same way as with `Handle Alert`.

    ``timeout`` specifies how long to wait for the alert to appear.
    If it is not given, the global default `timeout` is used instead.

    New in SeleniumLibrary 3.0.

Definition at line 45 of file alert.py.

Member Data Documentation

◆ _next_alert_action

SeleniumLibrary.keywords.alert.AlertKeywords._next_alert_action
staticprivate

Definition at line 32 of file alert.py.

◆ ACCEPT

string SeleniumLibrary.keywords.alert.AlertKeywords.ACCEPT = 'ACCEPT'
static

Definition at line 26 of file alert.py.

◆ DISMISS

string SeleniumLibrary.keywords.alert.AlertKeywords.DISMISS = 'DISMISS'
static

Definition at line 27 of file alert.py.

◆ LEAVE

string SeleniumLibrary.keywords.alert.AlertKeywords.LEAVE = 'LEAVE'
static

Definition at line 28 of file alert.py.


The documentation for this class was generated from the following file: