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

Public Member Functions

def add_location_strategy (self, strategy_name, strategy_keyword, persist=False)
 Adds a custom location strategy. More...
 
def assign_id_to_element (self, locator, id)
 Assigns temporary id to element specified by locator. More...
 
def clear_element_text (self, locator)
 Clears the value of text entry element identified by locator. More...
 
def click_button (self, locator, modifier=False)
 Clicks button identified by locator. More...
 
def click_element (self, locator, modifier=False)
 Click element identified by locator. More...
 
def click_element_at_coordinates (self, locator, xoffset, yoffset)
 Click element locator at xoffset/yoffset. More...
 
def click_image (self, locator, modifier=False)
 Clicks an image identified by locator. More...
 
def click_link (self, locator, modifier=False)
 Clicks a link identified by locator. More...
 
def cover_element (self, locator)
 Will cover elements identified by locator with a blue div without breaking page layout. More...
 
def double_click_element (self, locator)
 Double click element identified by locator. More...
 
def drag_and_drop (self, locator, target)
 Drags element identified by locator into target element. More...
 
def drag_and_drop_by_offset (self, locator, xoffset, yoffset)
 Drags element identified with locator by xoffset/yoffset. More...
 
def element_attribute_value_should_be (self, locator, attribute, expected, message=None)
 Verifies element identified by locator contains expected attribute value. More...
 
def element_should_be_disabled (self, locator)
 Verifies that element identified with locator is disabled. More...
 
def element_should_be_enabled (self, locator)
 Verifies that element identified with locator is enabled. More...
 
def element_should_be_focused (self, locator)
 Verifies that element identified with locator is focused. More...
 
def element_should_be_visible (self, locator, message=None)
 Verifies that the element identified by locator is visible. More...
 
def element_should_contain (self, locator, expected, message=None, ignore_case=False)
 Verifies that element locator contains text expected. More...
 
def element_should_not_be_visible (self, locator, message=None)
 Verifies that the element identified by locator is NOT visible. More...
 
def element_should_not_contain (self, locator, expected, message=None, ignore_case=False)
 Verifies that element locator does not contains text expected. More...
 
def element_text_should_be (self, locator, expected, message=None, ignore_case=False)
 Verifies that element locator contains exact text expected. More...
 
def element_text_should_not_be (self, locator, not_expected, message=None, ignore_case=False)
 Verifies that element locator does not contain exact text not_expected. More...
 
def get_all_links (self)
 Returns a list containing ids of all links found in current page. More...
 
def get_element_attribute (self, locator, attribute)
 Returns value of attribute from element locator. More...
 
def get_element_count (self, locator)
 Returns number of elements matching locator. More...
 
def get_element_size (self, locator)
 Returns width and height of element identified by locator. More...
 
def get_horizontal_position (self, locator)
 Returns horizontal position of element identified by locator. More...
 
def get_text (self, locator)
 Returns the text value of element identified by locator. More...
 
def get_value (self, locator)
 Returns the value attribute of element identified by locator. More...
 
def get_vertical_position (self, locator)
 Returns vertical position of element identified by locator. More...
 
def get_webelement (self, locator)
 Returns the first WebElement matching the given locator. More...
 
def get_webelements (self, locator)
 Returns list of WebElement objects matching the locator. More...
 
def locator_should_match_x_times (self, locator, x, message=None, loglevel='TRACE')
 DEPRECATED in SeleniumLibrary 4.0. More...
 
def mouse_down (self, locator)
 Simulates pressing the left mouse button on the element locator. More...
 
def mouse_down_on_image (self, locator)
 Simulates a mouse down event on an image identified by locator. More...
 
def mouse_down_on_link (self, locator)
 Simulates a mouse down event on a link identified by locator. More...
 
def mouse_out (self, locator)
 Simulates moving mouse away from the element locator. More...
 
def mouse_over (self, locator)
 Simulates hovering mouse over the element locator. More...
 
def mouse_up (self, locator)
 Simulates releasing the left mouse button on the element locator. More...
 
def open_context_menu (self, locator)
 Opens context menu on element identified by locator. More...
 
def page_should_contain (self, text, loglevel='TRACE')
 Verifies that current page contains text. More...
 
def page_should_contain_element (self, locator, message=None, loglevel='TRACE', limit=None)
 Verifies that element locator is found on the current page. More...
 
def page_should_contain_image (self, locator, message=None, loglevel='TRACE')
 Verifies image identified by locator is found from current page. More...
 
def page_should_contain_link (self, locator, message=None, loglevel='TRACE')
 Verifies link identified by locator is found from current page. More...
 
def page_should_not_contain (self, text, loglevel='TRACE')
 Verifies the current page does not contain text. More...
 
def page_should_not_contain_element (self, locator, message=None, loglevel='TRACE')
 Verifies that element locator is found on the current page. More...
 
def page_should_not_contain_image (self, locator, message=None, loglevel='TRACE')
 Verifies image identified by locator is found from current page. More...
 
def page_should_not_contain_link (self, locator, message=None, loglevel='TRACE')
 Verifies link identified by locator is not found from current page. More...
 
def parse_modifier (self, modifier)
 
def press_key (self, locator, key)
 DEPRECATED in SeleniumLibrary 4.0. More...
 
def press_keys (self, locator=None, *keys)
 Simulates user pressing key(s) to an element or on the active browser. More...
 
def remove_location_strategy (self, strategy_name)
 Removes a previously added custom location strategy. More...
 
def scroll_element_into_view (self, locator)
 Scrolls an element identified by locator into view. More...
 
def set_focus_to_element (self, locator)
 Sets focus to element identified by locator. More...
 
def simulate_event (self, locator, event)
 Simulates event on element identified by locator. 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)
 

Private Member Functions

def _click_with_modifier (self, locator, tag, modifier)
 
def _convert_special_keys (self, keys)
 
def _map_ascii_key_code_to_key (self, key_code)
 
def _map_named_key_code_to_special_key (self, key_name)
 
def _page_contains (self, text)
 
def _parse_aliases (self, key)
 
def _parse_keys (self, *keys)
 
def _press_keys (self, locator, parsed_keys)
 
def _press_keys_normal_keys (self, actions, element, key)
 
def _press_keys_special_keys (self, actions, element, parsed_key, key, special_keys)
 
def _selenium_keys_has_attr (self, key)
 
def _separate_key (self, key)
 

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 29 of file element.py.

Member Function Documentation

◆ _click_with_modifier()

def SeleniumLibrary.keywords.element.ElementKeywords._click_with_modifier (   self,
  locator,
  tag,
  modifier 
)
private

Definition at line 602 of file element.py.

◆ _convert_special_keys()

def SeleniumLibrary.keywords.element.ElementKeywords._convert_special_keys (   self,
  keys 
)
private

Definition at line 1114 of file element.py.

◆ _map_ascii_key_code_to_key()

def SeleniumLibrary.keywords.element.ElementKeywords._map_ascii_key_code_to_key (   self,
  key_code 
)
private

Definition at line 1021 of file element.py.

◆ _map_named_key_code_to_special_key()

def SeleniumLibrary.keywords.element.ElementKeywords._map_named_key_code_to_special_key (   self,
  key_name 
)
private

Definition at line 1046 of file element.py.

◆ _page_contains()

def SeleniumLibrary.keywords.element.ElementKeywords._page_contains (   self,
  text 
)
private

Definition at line 1054 of file element.py.

◆ _parse_aliases()

def SeleniumLibrary.keywords.element.ElementKeywords._parse_aliases (   self,
  key 
)
private

Definition at line 1094 of file element.py.

◆ _parse_keys()

def SeleniumLibrary.keywords.element.ElementKeywords._parse_keys (   self,
keys 
)
private

Definition at line 1084 of file element.py.

◆ _press_keys()

def SeleniumLibrary.keywords.element.ElementKeywords._press_keys (   self,
  locator,
  parsed_keys 
)
private

Definition at line 857 of file element.py.

◆ _press_keys_normal_keys()

def SeleniumLibrary.keywords.element.ElementKeywords._press_keys_normal_keys (   self,
  actions,
  element,
  key 
)
private

Definition at line 876 of file element.py.

◆ _press_keys_special_keys()

def SeleniumLibrary.keywords.element.ElementKeywords._press_keys_special_keys (   self,
  actions,
  element,
  parsed_key,
  key,
  special_keys 
)
private

Definition at line 883 of file element.py.

◆ _selenium_keys_has_attr()

def SeleniumLibrary.keywords.element.ElementKeywords._selenium_keys_has_attr (   self,
  key 
)
private

Definition at line 1125 of file element.py.

◆ _separate_key()

def SeleniumLibrary.keywords.element.ElementKeywords._separate_key (   self,
  key 
)
private

Definition at line 1101 of file element.py.

◆ add_location_strategy()

def SeleniumLibrary.keywords.element.ElementKeywords.add_location_strategy (   self,
  strategy_name,
  strategy_keyword,
  persist = False 
)

Adds a custom location strategy.

    See `Custom locators` for information how to create and use
    custom strategies. `Remove Location Strategy` can be used to
    remove a registered strategy.

    Location strategies are automatically removed after leaving the
    current scope by default. Setting ``persist`` to a true value (see
    `Boolean arguments`) will cause the location strategy to stay
    registered throughout the life of the test.

Definition at line 1009 of file element.py.

◆ assign_id_to_element()

def SeleniumLibrary.keywords.element.ElementKeywords.assign_id_to_element (   self,
  locator,
  id 
)

Assigns temporary id to element specified by locator.

    This is mainly useful if the locator is complicated and/or slow XPath
    expression and it is needed multiple times. Identifier expires when
    the page is reloaded.

    See the `Locating elements` section for details about the locator
    syntax.

    Example:
    | `Assign ID to Element` | //ul[@class='example' and ./li[contains(., 'Stuff')]] | my id |
    | `Page Should Contain Element` | my id |

Definition at line 224 of file element.py.

◆ clear_element_text()

def SeleniumLibrary.keywords.element.ElementKeywords.clear_element_text (   self,
  locator 
)

Clears the value of text entry element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 492 of file element.py.

◆ click_button()

def SeleniumLibrary.keywords.element.ElementKeywords.click_button (   self,
  locator,
  modifier = False 
)

Clicks button identified by locator.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, buttons are
    searched using ``id``, ``name`` and ``value``.

    See the `Click Element` keyword for details about the
    ``modifier`` argument.

    The ``modifier`` argument is new in SeleniumLibrary 3.3

Definition at line 521 of file element.py.

◆ click_element()

def SeleniumLibrary.keywords.element.ElementKeywords.click_element (   self,
  locator,
  modifier = False 
)

Click element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

    The ``modifier`` argument can be used to pass
    [https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html#selenium.webdriver.common.keys.Keys|Selenium Keys]
    when clicking the element. The `+` can be used as a separator
    for different Selenium Keys. The `CTRL` is internally translated to
    `CONTROL` key. The ``modifier`` is space and case insensitive, example
    "alt" and " aLt " are supported formats to
    [https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html#selenium.webdriver.common.keys.Keys.ALT|ALT key]
    . If ``modifier`` does not match to Selenium Keys, keyword fails.

    Example:
    | Click Element | id:button | | # Would click element without any modifiers. |
    | Click Element | id:button | CTRL | # Would click element with CTLR key pressed down. |
    | Click Element | id:button | CTRL+ALT | # Would click element with CTLR and ALT keys pressed down. |

    The ``modifier`` argument is new in SeleniumLibrary 3.2

Definition at line 595 of file element.py.

◆ click_element_at_coordinates()

def SeleniumLibrary.keywords.element.ElementKeywords.click_element_at_coordinates (   self,
  locator,
  xoffset,
  yoffset 
)

Click element locator at xoffset/yoffset.

    Cursor is moved and the center of the element and x/y coordinates are
    calculated from that point.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 625 of file element.py.

◆ click_image()

def SeleniumLibrary.keywords.element.ElementKeywords.click_image (   self,
  locator,
  modifier = False 
)

Clicks an image identified by locator.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, images are searched
    using ``id``, ``name``, ``src`` and ``alt``.

    See the `Click Element` keyword for details about the
    ``modifier`` argument.

    The ``modifier`` argument is new in SeleniumLibrary 3.3

Definition at line 543 of file element.py.

◆ click_link()

def SeleniumLibrary.keywords.element.ElementKeywords.click_link (   self,
  locator,
  modifier = False 
)

Clicks a link identified by locator.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, links are searched
    using ``id``, ``name``, ``href`` and the link text.

    See the `Click Element` keyword for details about the
    ``modifier`` argument.

    The ``modifier`` argument is new in SeleniumLibrary 3.3

Definition at line 566 of file element.py.

◆ cover_element()

def SeleniumLibrary.keywords.element.ElementKeywords.cover_element (   self,
  locator 
)

Will cover elements identified by locator with a blue div without breaking page layout.

    See the `Locating elements` section for details about the locator
    syntax.

    New in SeleniumLibrary 3.3.0

    Example:
    |`Cover Element` | css:div#container |

Definition at line 446 of file element.py.

◆ double_click_element()

def SeleniumLibrary.keywords.element.ElementKeywords.double_click_element (   self,
  locator 
)

Double click element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 641 of file element.py.

◆ drag_and_drop()

def SeleniumLibrary.keywords.element.ElementKeywords.drag_and_drop (   self,
  locator,
  target 
)

Drags element identified by locator into target element.

    The ``locator`` argument is the locator of the dragged element
    and the ``target`` is the locator of the target. See the
    `Locating elements` section for details about the locator syntax.

    Example:
    | `Drag And Drop` | css:div#element | css:div.target |

Definition at line 681 of file element.py.

◆ drag_and_drop_by_offset()

def SeleniumLibrary.keywords.element.ElementKeywords.drag_and_drop_by_offset (   self,
  locator,
  xoffset,
  yoffset 
)

Drags element identified with locator by xoffset/yoffset.

    See the `Locating elements` section for details about the locator
    syntax.

    Element will be moved by ``xoffset`` and ``yoffset``, each of which
    is a negative or positive number specifying the offset.

    Example:
    | `Drag And Drop By Offset` | myElem | 50 | -35 | # Move myElem 50px right and 35px down |

Definition at line 699 of file element.py.

◆ element_attribute_value_should_be()

def SeleniumLibrary.keywords.element.ElementKeywords.element_attribute_value_should_be (   self,
  locator,
  attribute,
  expected,
  message = None 
)

Verifies element identified by locator contains expected attribute value.

    See the `Locating elements` section for details about the locator
    syntax.

    Example:
    `Element Attribute Value Should Be` | css:img | href | value

    New in SeleniumLibrary 3.2.

Definition at line 397 of file element.py.

◆ element_should_be_disabled()

def SeleniumLibrary.keywords.element.ElementKeywords.element_should_be_disabled (   self,
  locator 
)

Verifies that element identified with locator is disabled.

    This keyword considers also elements that are read-only to be
    disabled.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 238 of file element.py.

◆ element_should_be_enabled()

def SeleniumLibrary.keywords.element.ElementKeywords.element_should_be_enabled (   self,
  locator 
)

Verifies that element identified with locator is enabled.

    This keyword considers also elements that are read-only to be
    disabled.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 251 of file element.py.

◆ element_should_be_focused()

def SeleniumLibrary.keywords.element.ElementKeywords.element_should_be_focused (   self,
  locator 
)

Verifies that element identified with locator is focused.

    See the `Locating elements` section for details about the locator
    syntax.

    New in SeleniumLibrary 3.0.

Definition at line 263 of file element.py.

◆ element_should_be_visible()

def SeleniumLibrary.keywords.element.ElementKeywords.element_should_be_visible (   self,
  locator,
  message = None 
)

Verifies that the element identified by locator is visible.

    Herein, visible means that the element is logically visible, not
    optically visible in the current browser viewport. For example,
    an element that carries ``display:none`` is not logically visible,
    so using this keyword on that element would fail.

    See the `Locating elements` section for details about the locator
    syntax.

    The ``message`` argument can be used to override the default error
    message.

Definition at line 286 of file element.py.

◆ element_should_contain()

def SeleniumLibrary.keywords.element.ElementKeywords.element_should_contain (   self,
  locator,
  expected,
  message = None,
  ignore_case = False 
)

Verifies that element locator contains text expected.

    See the `Locating elements` section for details about the locator
    syntax.

    The ``message`` argument can be used to override the default error
    message.

    The ``ignore_case`` argument can be set to True to compare case
    insensitive, default is False. New in SeleniumLibrary 3.1.

    ``ignore_case`` argument new in SeleniumLibrary 3.1.

    Use `Element Text Should Be` if you want to match the exact text,
    not a substring.

Definition at line 70 of file element.py.

◆ element_should_not_be_visible()

def SeleniumLibrary.keywords.element.ElementKeywords.element_should_not_be_visible (   self,
  locator,
  message = None 
)

Verifies that the element identified by locator is NOT visible.

    Passes if element does not exists. See `Element Should Be Visible`
    for more information about visibility and supported arguments.

Definition at line 300 of file element.py.

◆ element_should_not_contain()

def SeleniumLibrary.keywords.element.ElementKeywords.element_should_not_contain (   self,
  locator,
  expected,
  message = None,
  ignore_case = False 
)

Verifies that element locator does not contains text expected.

    See the `Locating elements` section for details about the locator
    syntax.

    The ``message`` argument can be used to override the default error
    message.

    The ``ignore_case`` argument can be set to True to compare case
    insensitive, default is False.

    ``ignore_case`` argument new in SeleniumLibrary 3.1.

Definition at line 97 of file element.py.

◆ element_text_should_be()

def SeleniumLibrary.keywords.element.ElementKeywords.element_text_should_be (   self,
  locator,
  expected,
  message = None,
  ignore_case = False 
)

Verifies that element locator contains exact text expected.

    See the `Locating elements` section for details about the locator
    syntax.

    The ``message`` argument can be used to override the default error
    message.

    The ``ignore_case`` argument can be set to True to compare case
    insensitive, default is False.

    ``ignore_case`` argument new in SeleniumLibrary 3.1.

    Use `Element Should Contain` if a substring match is desired.

Definition at line 328 of file element.py.

◆ element_text_should_not_be()

def SeleniumLibrary.keywords.element.ElementKeywords.element_text_should_not_be (   self,
  locator,
  not_expected,
  message = None,
  ignore_case = False 
)

Verifies that element locator does not contain exact text not_expected.

    See the `Locating elements` section for details about the locator
    syntax.

    The ``message`` argument can be used to override the default error
    message.

    The ``ignore_case`` argument can be set to True to compare case
    insensitive, default is False.

    New in SeleniumLibrary 3.1.1

Definition at line 356 of file element.py.

◆ get_all_links()

def SeleniumLibrary.keywords.element.ElementKeywords.get_all_links (   self)

Returns a list containing ids of all links found in current page.

    If a link has no id, an empty string will be in the list instead.

Definition at line 901 of file element.py.

◆ get_element_attribute()

def SeleniumLibrary.keywords.element.ElementKeywords.get_element_attribute (   self,
  locator,
  attribute 
)

Returns value of attribute from element locator.

    See the `Locating elements` section for details about the locator
    syntax.

    Example:
    | ${id}= | `Get Element Attribute` | css:h1 | id |

    Passing attribute name as part of the ``locator`` was removed
    in SeleniumLibrary 3.2. The explicit ``attribute`` argument
    should be used instead.

Definition at line 383 of file element.py.

◆ get_element_count()

def SeleniumLibrary.keywords.element.ElementKeywords.get_element_count (   self,
  locator 
)

Returns number of elements matching locator.

    If you wish to assert the number of matching elements, use
    `Page Should Contain Element` with ``limit`` argument. Keyword will
    always return an integer.

    Example:
    | ${count} =       | `Get Element Count` | name:div_name  |
    | `Should Be True` | ${count} > 2        |                |

    New in SeleniumLibrary 3.0.

Definition at line 994 of file element.py.

◆ get_element_size()

def SeleniumLibrary.keywords.element.ElementKeywords.get_element_size (   self,
  locator 
)

Returns width and height of element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

    Both width and height are returned as integers.

    Example:
    | ${width} | ${height} = | `Get Element Size` | css:div#container |

Definition at line 431 of file element.py.

◆ get_horizontal_position()

def SeleniumLibrary.keywords.element.ElementKeywords.get_horizontal_position (   self,
  locator 
)

Returns horizontal position of element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

    The position is returned in pixels off the left side of the page,
    as an integer.

    See also `Get Vertical Position`.

Definition at line 417 of file element.py.

◆ get_text()

def SeleniumLibrary.keywords.element.ElementKeywords.get_text (   self,
  locator 
)

Returns the text value of element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 483 of file element.py.

◆ get_value()

def SeleniumLibrary.keywords.element.ElementKeywords.get_value (   self,
  locator 
)

Returns the value attribute of element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 474 of file element.py.

◆ get_vertical_position()

def SeleniumLibrary.keywords.element.ElementKeywords.get_vertical_position (   self,
  locator 
)

Returns vertical position of element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

    The position is returned in pixels off the top of the page,
    as an integer.

    See also `Get Horizontal Position`.

Definition at line 506 of file element.py.

◆ get_webelement()

def SeleniumLibrary.keywords.element.ElementKeywords.get_webelement (   self,
  locator 
)

Returns the first WebElement matching the given locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 37 of file element.py.

◆ get_webelements()

def SeleniumLibrary.keywords.element.ElementKeywords.get_webelements (   self,
  locator 
)

Returns list of WebElement objects matching the locator.

    See the `Locating elements` section for details about the locator
    syntax.

    Starting from SeleniumLibrary 3.0, the keyword returns an empty
    list if there are no matching elements. In previous releases the
    keyword failed in this case.

Definition at line 50 of file element.py.

◆ locator_should_match_x_times()

def SeleniumLibrary.keywords.element.ElementKeywords.locator_should_match_x_times (   self,
  locator,
  x,
  message = None,
  loglevel = 'TRACE' 
)

DEPRECATED in SeleniumLibrary 4.0.

, use Page Should Contain Element with limit argument instead.

Definition at line 171 of file element.py.

◆ mouse_down()

def SeleniumLibrary.keywords.element.ElementKeywords.mouse_down (   self,
  locator 
)

Simulates pressing the left mouse button on the element locator.

    See the `Locating elements` section for details about the locator
    syntax.

    The element is pressed without releasing the mouse button.

    See also the more specific keywords `Mouse Down On Image` and
    `Mouse Down On Link`.

Definition at line 716 of file element.py.

◆ mouse_down_on_image()

def SeleniumLibrary.keywords.element.ElementKeywords.mouse_down_on_image (   self,
  locator 
)

Simulates a mouse down event on an image identified by locator.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, images are searched
    using ``id``, ``name``, ``src`` and ``alt``.

Definition at line 950 of file element.py.

◆ mouse_down_on_link()

def SeleniumLibrary.keywords.element.ElementKeywords.mouse_down_on_link (   self,
  locator 
)

Simulates a mouse down event on a link identified by locator.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, links are searched
    using ``id``, ``name``, ``href`` and the link text.

Definition at line 912 of file element.py.

◆ mouse_out()

def SeleniumLibrary.keywords.element.ElementKeywords.mouse_out (   self,
  locator 
)

Simulates moving mouse away from the element locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 728 of file element.py.

◆ mouse_over()

def SeleniumLibrary.keywords.element.ElementKeywords.mouse_over (   self,
  locator 
)

Simulates hovering mouse over the element locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 744 of file element.py.

◆ mouse_up()

def SeleniumLibrary.keywords.element.ElementKeywords.mouse_up (   self,
  locator 
)

Simulates releasing the left mouse button on the element locator.

    See the `Locating elements` section for details about the locator
    syntax.

Definition at line 756 of file element.py.

◆ open_context_menu()

def SeleniumLibrary.keywords.element.ElementKeywords.open_context_menu (   self,
  locator 
)

Opens context menu on element identified by locator.

Definition at line 763 of file element.py.

◆ page_should_contain()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_contain (   self,
  text,
  loglevel = 'TRACE' 
)

Verifies that current page contains text.

    If this keyword fails, it automatically logs the page source
    using the log level specified with the optional ``loglevel``
    argument. Valid log levels are ``DEBUG``, ``INFO`` (default),
    ``WARN``, and ``NONE``. If the log level is ``NONE`` or below
    the current active log level the source will not be logged.

Definition at line 120 of file element.py.

◆ page_should_contain_element()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_contain_element (   self,
  locator,
  message = None,
  loglevel = 'TRACE',
  limit = None 
)

Verifies that element locator is found on the current page.

    See the `Locating elements` section for details about the locator
    syntax.

    The ``message`` argument can be used to override the default error
    message.

    The ``limit`` argument can used to define how many elements the
    page should contain. When ``limit`` is ``None`` (default) page can
    contain one or more elements. When limit is a number, page must
    contain same number of elements.

    See `Page Should Contain` for explanation about the ``loglevel``
    argument.

    Examples assumes that locator matches to two elements.
    | `Page Should Contain Element` | div_name | limit=1    | # Keyword fails.                  |
    | `Page Should Contain Element` | div_name | limit=2    | # Keyword passes.                 |
    | `Page Should Contain Element` | div_name | limit=none | # None is considered one or more. |
    | `Page Should Contain Element` | div_name |            | # Same as above.                  |

    The ``limit`` argument is new in SeleniumLibrary 3.0.

Definition at line 152 of file element.py.

◆ page_should_contain_image()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_contain_image (   self,
  locator,
  message = None,
  loglevel = 'TRACE' 
)

Verifies image identified by locator is found from current page.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, images are searched
    using ``id``, ``name``, ``src`` and ``alt``.

    See `Page Should Contain Element` for explanation about ``message``
    and ``loglevel`` arguments.

Definition at line 965 of file element.py.

◆ page_should_contain_link()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_contain_link (   self,
  locator,
  message = None,
  loglevel = 'TRACE' 
)

Verifies link identified by locator is found from current page.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, links are searched
    using ``id``, ``name``, ``href`` and the link text.

    See `Page Should Contain Element` for explanation about ``message``
    and ``loglevel`` arguments.

Definition at line 927 of file element.py.

◆ page_should_not_contain()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_not_contain (   self,
  text,
  loglevel = 'TRACE' 
)

Verifies the current page does not contain text.

    See `Page Should Contain` for explanation about the ``loglevel``
    argument.

Definition at line 190 of file element.py.

◆ page_should_not_contain_element()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_not_contain_element (   self,
  locator,
  message = None,
  loglevel = 'TRACE' 
)

Verifies that element locator is found on the current page.

    See the `Locating elements` section for details about the locator
    syntax.

    See `Page Should Contain` for explanation about ``message`` and
    ``loglevel`` arguments.

Definition at line 206 of file element.py.

◆ page_should_not_contain_image()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_not_contain_image (   self,
  locator,
  message = None,
  loglevel = 'TRACE' 
)

Verifies image identified by locator is found from current page.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, images are searched
    using ``id``, ``name``, ``src`` and ``alt``.

    See `Page Should Contain Element` for explanation about ``message``
    and ``loglevel`` arguments.

Definition at line 978 of file element.py.

◆ page_should_not_contain_link()

def SeleniumLibrary.keywords.element.ElementKeywords.page_should_not_contain_link (   self,
  locator,
  message = None,
  loglevel = 'TRACE' 
)

Verifies link identified by locator is not found from current page.

    See the `Locating elements` section for details about the locator
    syntax. When using the default locator strategy, links are searched
    using ``id``, ``name``, ``href`` and the link text.

    See `Page Should Contain Element` for explanation about ``message``
    and ``loglevel`` arguments.

Definition at line 940 of file element.py.

◆ parse_modifier()

def SeleniumLibrary.keywords.element.ElementKeywords.parse_modifier (   self,
  modifier 
)

Definition at line 1070 of file element.py.

◆ press_key()

def SeleniumLibrary.keywords.element.ElementKeywords.press_key (   self,
  locator,
  key 
)

DEPRECATED in SeleniumLibrary 4.0.

use Press Keys instead.

Definition at line 795 of file element.py.

◆ press_keys()

def SeleniumLibrary.keywords.element.ElementKeywords.press_keys (   self,
  locator = None,
keys 
)

Simulates user pressing key(s) to an element or on the active browser.

    If ``locator`` evaluates as false, see `Boolean arguments` for more
    details, then the ``keys`` are sent to the currently active browser.
    Otherwise element is searched and ``keys`` are send to the element
    identified by the ``locator``. In later case, keyword fails if element
    is not found. See the `Locating elements` section for details about
    the locator syntax.

    ``keys`` arguments can contain one or many strings, but it can not
    be empty. ``keys`` can also be a combination of
    [https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html|Selenium Keys]
    and strings or a single Selenium Key. If Selenium Key is combined
    with strings, Selenium key and strings must be separated by the
    `+` character, like in `CONTROL+c`. Selenium Keys
    are space and case sensitive and Selenium Keys are not parsed
    inside of the string. Example AALTO, would send string `AALTO`
    and `ALT` not parsed inside of the string. But `A+ALT+O` would
    found Selenium ALT key from the ``keys`` argument. It also possible
    to press many Selenium Keys down at the same time, example
    'ALT+ARROW_DOWN`.

    If Selenium Keys are detected in the ``keys`` argument, keyword
    will press the Selenium Key down, send the strings and
     then release the Selenium Key. If keyword needs to send a Selenium
    Key as a string, then each character must be separated with
    `+` character, example `E+N+D`.

    `CTRL` is alias for
    [https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html#selenium.webdriver.common.keys.Keys.CONTROL|Selenium CONTROL]
    and ESC is alias for
    [https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html#selenium.webdriver.common.keys.Keys.ESCAPE|Selenium ESCAPE]

    New in SeleniumLibrary 3.3

    Examples:
    | `Press Keys` | text_field | AAAAA          |            | # Sends string "AAAAA" to element.                                                |
    | `Press Keys` | None       | BBBBB          |            | # Sends string "BBBBB" to currently active browser.                               |
    | `Press Keys` | text_field | E+N+D          |            | # Sends string "END" to element.                                                  |
    | `Press Keys` | text_field | XXX            | YY         | # Sends strings "XXX" and "YY" to element.                                        |
    | `Press Keys` | text_field | XXX+YY         |            | # Same as above.                                                                  |
    | `Press Keys` | text_field | ALT+ARROW_DOWN |            | # Pressing "ALT" key down, then pressing ARROW_DOWN and then releasing both keys. |
    | `Press Keys` | text_field | ALT            | ARROW_DOWN | # Pressing "ALT" key and then pressing ARROW_DOWN.                                |
    | `Press Keys` | text_field | CTRL+c         |            | # Pressing CTRL key down, sends string "c" and then releases CTRL key.            |
    | `Press Keys` | button     | RETURN         |            | # Pressing "ENTER" key to element.                                                |

Definition at line 849 of file element.py.

◆ remove_location_strategy()

def SeleniumLibrary.keywords.element.ElementKeywords.remove_location_strategy (   self,
  strategy_name 
)

Removes a previously added custom location strategy.

    See `Custom locators` for information how to create and use
    custom strategies.

Definition at line 1018 of file element.py.

◆ scroll_element_into_view()

def SeleniumLibrary.keywords.element.ElementKeywords.scroll_element_into_view (   self,
  locator 
)

Scrolls an element identified by locator into view.

    See the `Locating elements` section for details about the locator
    syntax.

    New in SeleniumLibrary 3.2.0

Definition at line 667 of file element.py.

◆ set_focus_to_element()

def SeleniumLibrary.keywords.element.ElementKeywords.set_focus_to_element (   self,
  locator 
)

Sets focus to element identified by locator.

    See the `Locating elements` section for details about the locator
    syntax.

    Prior to SeleniumLibrary 3.0 this keyword was named `Focus`.

Definition at line 655 of file element.py.

◆ simulate_event()

def SeleniumLibrary.keywords.element.ElementKeywords.simulate_event (   self,
  locator,
  event 
)

Simulates event on element identified by locator.

    This keyword is useful if element has ``OnEvent`` handler that
    needs to be explicitly invoked.

    See the `Locating elements` section for details about the locator
    syntax.

    Prior to SeleniumLibrary 3.0 this keyword was named `Simulate`.

Definition at line 779 of file element.py.


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